Skip to content

Wait for Nextjs rehydration before zustand store rehydration #938

@MoustaphaDev

Description

@MoustaphaDev

Hello, I'm using the persist middleware on my store with Nextjs (SSG) and I got several warnings in dev mode all pointing:
Error: Hydration failed because the initial UI does not match what was rendered on the server.
It doesn't break the app however.

Looks like the zustand store rehydrates before Nextjs has finished its rehydration process.
Is there a way trigger the rehydration of the zustand store after Nextjs' rehydration process or are there better ways of handling this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    middleware/persistThis issue is about the persist middleware

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions