Skip to content

docs: investigate Navigation API multiple redirect behavior#137

Merged
uhyo merged 3 commits intomasterfrom
claude/investigate-nav-redirects-Rsg3I
Feb 28, 2026
Merged

docs: investigate Navigation API multiple redirect behavior#137
uhyo merged 3 commits intomasterfrom
claude/investigate-nav-redirects-Rsg3I

Conversation

@uhyo
Copy link
Owner

@uhyo uhyo commented Feb 28, 2026

Research how NavigationPrecommitController.redirect() handles being
called multiple times. WPT tests confirm that multiple calls are
explicitly supported (last one wins) and do not throw errors.

The controller wrapping proposed in the precommit design document is
not needed for API correctness, but remains valuable as a router-level
concern to prevent child handlers from running with stale params or
accidentally overriding parent redirects.

https://claude.ai/code/session_016RPQMedsHScA28s2CbbuZs

Research how NavigationPrecommitController.redirect() handles being
called multiple times. WPT tests confirm that multiple calls are
explicitly supported (last one wins) and do not throw errors.

The controller wrapping proposed in the precommit design document is
not needed for API correctness, but remains valuable as a router-level
concern to prevent child handlers from running with stale params or
accidentally overriding parent redirects.

https://claude.ai/code/session_016RPQMedsHScA28s2CbbuZs
…port

Update the precommit handler design based on investigation findings:

- Replace `NavigationPrecommitController` with a router-provided `redirect`
  function in PrecommitArgs, hiding the native API from route authors
- Make precommit handlers synchronous-only (async data fetching belongs in
  loaders post-commit)
- Add redirect chain support: after redirect, re-match routes against the
  new URL and run the new match stack's precommit handlers
- Add max iteration guard (10) to prevent infinite redirect loops
- Update investigation conclusion to reflect the chosen approach
- Expand test cases for redirect chains, correct params after redirect,
  and infinite loop detection

https://claude.ai/code/session_016RPQMedsHScA28s2CbbuZs
The platform supports async precommitHandlers, so the router should too.
Update the design to await each precommit handler, but strongly recommend
synchronous handlers since async work delays the URL bar update.

https://claude.ai/code/session_016RPQMedsHScA28s2CbbuZs
@uhyo uhyo merged commit ec0e1f1 into master Feb 28, 2026
1 check passed
@uhyo uhyo deleted the claude/investigate-nav-redirects-Rsg3I branch February 28, 2026 06:15
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.

2 participants