T
TanStack2y ago
conscious-sapphire

Is it just me or does HMR sometimes put the router into very strange states?

During development I will frequently come across Links that all of the sudden (after HMR) point to the exact URL I am on instead of their usual path. Which links are broken seems to depend on which portion of the DOM tree was hot-reloaded. For instance, attached is a screenshot of what the side-nav in my app looks like after tweaking some CSS around that component. Each of the nav Links show their "active" styling and point to the page I was on before the component was hot-reloaded (in this case they all point to /document/edit/$id as shown in the preview bar). I have also noticed an issue (after HMR) where context-consuming components will sometimes cause the app to blow up as if they are being used outside of their corresponding context provider, even though they are not. Again, this seems to depend on which part of the DOM tree was hot-reloaded. In both of these cases the solution is simply to hard-refresh the page, and the issue goes away. I am just wondering if these are common issues or if perhaps they are symptoms of a problem somewhere in my implementation of TSR.
No description
1 Reply
exotic-emerald
exotic-emerald2y ago
can you provide a minimal complete example?

Did you find this page helpful?