docs: investigate Navigation API multiple redirect behavior#137
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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