#Live refresh - how to debug / configure?

25 messages · Page 1 of 1 (latest)

lunar narwhal
#

We are having a problem with one of our third party libraries (cube.js) triggering fast refresh. We know it's definitely this library causing the problem because it only started after we added it, and the problem goes away once we remove the library. However, we don't know exactly where the problem is happening. I'm hoping to find out how to both a) turn on some kind of debug log for fast refresh that can tell us WHY a full-page reload was triggered and then b) how to configure fast refresh so that this doesn't happen anymore.

#

there's some basic docs out there explaining what fast refresh is but I'm not finding a whole lot about how to work with it / refine it

mossy jetty
#

yeah afaik theres not much documented about it. I think next only triggers the fast refresh if the source files are saved, so I am not sure why a library would trigger a refresh

trim escarp
#

@lunar narwhal Do you have a code sample that I could try to replicate?

lunar narwhal
#

well, I was sorta hoping to just find out how to debug, not let someone else debug. I'm not allowed to just share our repo and it takes time to build a perfect reproduction repo

#

but I can work on that if you're saying you think you know how to track this down

trim escarp
#

I can try to replicate it on my side too, are you using the app directory or /pages ?

lunar narwhal
#

pages

#

yeah something tells me it's not just installing that package on its own that causes the problem. I'm sure something else we're doing on our end must cause the behavior, I just don't know what and it's sorta a large haystack to comb through

#

I'll work on a repo, if I can get something small to reproduce I'll send it your way. Thanks for writing back 😉

trim escarp
#

Are you using getServerSideProps or in a useEffect?

lunar narwhal
#

no getServerSideProps.

#

I mean we have lots of hook usage across the app but this seems to happen on every page so it's hard to narrow down

#

ie, all I have to do is go to a portion of the app that hasn't been compiled yet, and once that part of the app is compiled, all instances of the app will refresh

#

which also means, I never get routed to the new page I just compiled, so I have to click it again

trim escarp
#

My thought is, it's not actually a hot reload but the component (or page for some reason?) unmounting and reloading

#

oh

#

does it make some kind of cache folder?

lunar narwhal
#

I could believe the remounting being an issue but then why on several tabs at once

#

it does

#

but I've moved that cache folder out, and I'm still getting the refreshes on compile

#

which is where I'm like, what other files is it modifying

#

but I don't see them

trim escarp
#

If you preserve logs in the other open tabs, does it show anything in the console or on the network?