Skip to content

Hydration broken with React v16.10.0 #32

Closed
@Ephem

Description

@Ephem

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions