Skip to content

refactor: replace useSyncExternalStore with useState + useEffect for route transitions#69

Merged
uhyo merged 1 commit intomasterfrom
feature/route-transition
Feb 6, 2026
Merged

refactor: replace useSyncExternalStore with useState + useEffect for route transitions#69
uhyo merged 1 commit intomasterfrom
feature/route-transition

Conversation

@uhyo
Copy link
Owner

@uhyo uhyo commented Feb 6, 2026

Summary

  • Replaces useSyncExternalStore with useState + useEffect for subscribing to location changes in the <Router> component
  • This change enables future support for route transitions (e.g., startTransition), since useSyncExternalStore forces synchronous re-renders that cannot be wrapped in transitions
  • Handles SSR by checking typeof window for initial state, and syncs with the client snapshot on mount to cover SSR-to-hydration mismatches

Test plan

  • Run pnpm test:run to verify all existing tests pass
  • Run pnpm typecheck to verify type correctness
  • Test the example app (pnpm --filter funstack-router-example dev) and verify navigation still works correctly

🤖 Generated with Claude Code

@uhyo uhyo merged commit f1ea14c into master Feb 6, 2026
1 check passed
@uhyo uhyo deleted the feature/route-transition branch February 6, 2026 13:28
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