Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]:Error: Hydration Mismatch in SSR mode #1620

Closed
2 tasks done
g-mero opened this issue Sep 4, 2024 · 1 comment
Closed
2 tasks done

[Bug?]:Error: Hydration Mismatch in SSR mode #1620

g-mero opened this issue Sep 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@g-mero
Copy link

g-mero commented Sep 4, 2024

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

The appstate is persisted in localStorage. I wrap it in createRoot, and check its value when mount. If the initial value of appstate differs from the value stored in localStorage, it causes an error.

Test ok in SPA mode.

function NavItemWithChildren(props: NavItemType) {
  const [appstate] = useAppState()

  return (
    <Show when={appstate.isNavOpen} fallback={<FloatingMode />}>
      <CollapseMode />
    </Show>
  )
}

Expected behavior 🤔

No response

Steps to reproduce 🕹

Steps:

Context 🔦

No response

Your environment 🌎

No response

@g-mero g-mero added the bug Something isn't working label Sep 4, 2024
@g-mero
Copy link
Author

g-mero commented Sep 5, 2024

the error is expected when using storage, using onMount or initialize it in entry-client.tsx after mount.

@g-mero g-mero closed this as completed Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant