Skip to content

Route from / once the persisted store has hydrated - #247

Merged
soamdesai-tfh merged 1 commit into
mainfrom
soam/index-redirect-after-hydration
Sep 16, 2026
Merged

soamdesai-tfh merged 1 commit into
mainfrom
soam/index-redirect-after-hydration

Conversation

@soamdesai-tfh

Copy link
Copy Markdown
Contributor

Summary

Opening the simulator briefly showed the Test identities picker before landing on the active identity's home.

Root cause. Same hydration snapshot as #244: while the server-rendered / page hydrates, React renders with the store's pre-hydration state, in which no identity is active yet. The redirect effect acted on that and pushed /select-id; one render later it saw the real active identity and pushed /id/<id>.

Fix. The redirect now decides once, reading the live store after persist.hasHydrated() (or on onFinishHydration), and uses router.replace so / stays out of the history and Back doesn't bounce through it. Seeding runs first in the same commit phase and inserts synchronously, so a cold start still lands directly on the freshly seeded identity.

Verification

  • pnpm typecheck, pnpm lint, pnpm test (31/31), pnpm run spellcheck clean.
  • Client-side navigations recorded over the DevTools protocol on a profile with saved identities:
    • production today: / → /select-id → /id/0x18310f83
    • this branch: / → /id/0x18310f83

🤖 Generated with Claude Code

Opening the simulator flashed the identity picker before landing on the
active identity. The redirect effect on `/` read `activeIdentityID` from
the React snapshot, which is the pre-hydration state during the first
render, so it pushed `/select-id` and then, one render later, `/id/<id>`.

Decide once from the live store after `persist` has hydrated, mirroring the
seeding fix, and use `replace` so the redirect page stays out of history
and Back never bounces through it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
worldcoin-simulator Ready Ready Preview Sep 16, 2026 7:02pm UTC

Request Review

@soamdesai-tfh
soamdesai-tfh merged commit c46e6e7 into main Sep 16, 2026
7 of 9 checks passed
@soamdesai-tfh
soamdesai-tfh deleted the soam/index-redirect-after-hydration branch September 16, 2026 19:01

This branch was successfully deployed

1 active deployment
Preview — 71a10442 Deployed Sep 16, 2026 by vercel[bot]
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