Skip to content

[go_router] Fix relative navigation after imperative navigation - #12438

Open
Boulea7 wants to merge 1 commit into
flutter:mainfrom
Boulea7:fix-go-router-relative-navigation-182441
Open

[go_router] Fix relative navigation after imperative navigation#12438
Boulea7 wants to merge 1 commit into
flutter:mainfrom
Boulea7:fix-go-router-relative-navigation-182441

Conversation

@Boulea7

@Boulea7 Boulea7 commented Aug 11, 2026

Copy link
Copy Markdown

Relative navigation after an imperative push currently resolves against the underlying route information instead of the visible imperative route. This updates go, push, pushReplacement, and replace to 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

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-assist bot 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

  1. 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

@github-actions github-actions Bot added p: go_router triage-framework Should be looked at in framework triage labels Aug 11, 2026
@Boulea7
Boulea7 marked this pull request as ready for review August 12, 2026 06:05

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ../.

Comment thread packages/go_router/lib/src/router.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: go_router triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go_router_builder: TypedRelativeRoute always uses root route

1 participant