Skip to content

Conversation

@uhyo
Copy link
Owner

@uhyo uhyo commented Feb 7, 2026

Summary

  • Replace useSyncExternalStore + serverSnapshotSymbol sentinel with a simpler useState + useEffect approach in Router.tsx
  • Add explicit ssr prop to RouterProps — when true, the router starts with null locationEntry and syncs after hydration; when false (default), it initializes from adapter.getSnapshot() immediately
  • The unconditional setLocationEntry(adapter.getSnapshot()) in the mount effect is a no-op for non-SSR because adapters cache snapshots by referential identity

Test plan

  • pnpm build — builds successfully
  • pnpm typecheck — no type errors
  • pnpm test:run — all 174 tests pass (no test changes needed since ssr defaults to false)
  • pnpm format — code style compliant

🤖 Generated with Claude Code

…ydration mismatches

The Router component used useSyncExternalStore with a serverSnapshotSymbol
sentinel to handle the SSR/hydration boundary, which still caused React
hydration mismatch warnings. Replace it with a simpler useState + useEffect
approach controlled by an explicit `ssr` prop:

- ssr={false} (default): initialize locationEntry from adapter.getSnapshot()
- ssr={true}: start with null locationEntry, sync after hydration via useEffect

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@uhyo uhyo closed this Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant