[go_router] Fix relative navigation after imperative navigation - #12438
[go_router] Fix relative navigation after imperative navigation#12438Boulea7 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates GoRouter to resolve relative locations starting with ./ against the last imperatively-pushed route match for the go, push, pushReplacement, and replace methods, and adds corresponding regression tests. The review feedback suggests extending this resolution logic to also support relative paths starting with ../.
|
Hi @Boulea7 , just want to double check on the correct behavior, when using imperative API, the URL won't reflect the url of the pushed route. so for example if you are currently on |
Relative navigation after an imperative push currently resolves against the underlying route information instead of the visible imperative route. This updates
go,push,pushReplacement, andreplaceto resolve./locations against the imperative top match, while preserving the existing behavior for other locations. Regression coverage includes query parameters and fragments.This revisits and completes the fix proposed in #11726. Thank you @NadeemIqbal for the earlier investigation and implementation.
Fixes flutter/flutter#182441.
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2