Skip to content

Exposing length of mountedInstances to properly hydrate the client #34

@cwelch5

Description

@cwelch5

I'm attempting to fix this Helmet issue (nfl/react-helmet#149) and had the idea of making the client wait until all instances are mounted before allowing handleStateChangeOnClient to change the DOM. Then on the first render of the client (after SSR), it would only do one client state change which would match the server rendered side effects and thus would leave all the side effects intact. In order to "hydrate" the client like this, I'd need to pass along the number of mounted instances so that the client knows how many components to wait for. I can certainly add a mountedInstances inside of Helmet, but I felt it would be better to perhaps expose this from react-side-effect instead and not duplicate functionality.

I can certainly offer a PR here as well. Please let me know. Thanks!

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