HydrateFallback
being rendered intermittently on refresh in SPA without SSR
#12699
Labels
HydrateFallback
being rendered intermittently on refresh in SPA without SSR
#12699
I'm using React Router as a...
library
Reproduction
I can't share a full reproduction, and if this isn't a bug, an explanation of what causes this component to be rendered would be helpful (it's not in the docs).
System Info
Used Package Manager
yarn
Expected Behavior
I don't use
loader
or any SSR features, so I don't expect HydrateFallback to be necessary, let alone to render.The top-level skeleton of what I have is this:
The routes arrays are too complex to share, but a representative snippet would be:
Actual Behavior
Everything renders fine on the first page render always, but refreshing the page triggers the hydration fallback error maybe 20-30% of the time, which suggests a race condition.
I put in some debug logging into the render function of the top-level layout and it never renders, although parent context providers to the whole router do render as expected.
This behavior seems like a bug in react router (since I did not opt into any SSR features, so I would expect errors elsewhere in my application to trigger the
errorElement
not thehydrateFallbackElement
. In fact, I was genuinely surprised to find that that element event could be rendered when we don't useloader
or anything other thanlazy
loaders (and their failure really ought to be an errorElement render, if they happen -- which I don't believe to be happening in my case).But if it's a bug in our company's code, I'd at least appreciate some indication in the docs to help point people in the direction of how to debug this kind of thing.
The text was updated successfully, but these errors were encountered: