After preparing a merge and release for v16.10.0 I discovered a problem during testing, namely that hydration is broken when using Lightyear.
React v16.10.0 has ongoing work for Partial hydration which v16.9.0 did not have. From what I can tell the behaviour when React encounters a <Suspense> boundary during hydration has changed.
Error is: "Expected to have a hydrated suspense instance." which comes from prepareToHydrateHostSuspenseInstance.
Sadly, I don't think this can be fixed properly in Lightyear itself (but I'm 100% sure yet), in that case I see two possible ways forward (neither of which are verified to work):
- Needing to use a custom-built
react-dom together with Lightyear, with the enableSuspenseServerRenderer feature flag turned on (and/or some other tweak)
- App code only rendering
<Suspense> on the server, outputting a fragment on the client. This could be changed back to a <Suspense>-component after hydration.
After preparing a merge and release for v16.10.0 I discovered a problem during testing, namely that hydration is broken when using Lightyear.
React v16.10.0 has ongoing work for Partial hydration which v16.9.0 did not have. From what I can tell the behaviour when React encounters a
<Suspense>boundary during hydration has changed.Error is:
"Expected to have a hydrated suspense instance."which comes fromprepareToHydrateHostSuspenseInstance.Sadly, I don't think this can be fixed properly in Lightyear itself (but I'm 100% sure yet), in that case I see two possible ways forward (neither of which are verified to work):
react-domtogether with Lightyear, with theenableSuspenseServerRendererfeature flag turned on (and/or some other tweak)<Suspense>on the server, outputting a fragment on the client. This could be changed back to a<Suspense>-component after hydration.