SSR Hydration error in ChildRoute with Context set in ParentRoute and intermediate Context Update
I have a ParentRoute that retrieves RouteData and uses that data to populate a Context
In my child route, I get hydration errors when accessed directly via SSR. With Client-side navigation it works fine.
Context looks like this
Any ideas what went wrong here?
❤️
1 Reply
There's a bit more to it, that's I think relevant.
In some component the context is manipulated as well.
And then the updated, more complete, Context looks like this:
Now it's getting a bit convoluted. :/ Any help would be much appreciated, though.
I'd like to add that when logging the important bits of this chain the
Select
action from the context runs earlier than the log for Creating Child Route
so by that time, the Context should already have been updated.
At least for client-side rendering, that is.
It is fixed if I cut out the intermediate Context update step, remove if (query.id && !selectedId()) select(query.id)
and instead pass query.id
as initial Value to the context from Parent Route. No more hydration errors. This solves my use-case so it's good enough for me, but is this not working otherwise expected?