-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[go_router] Fixes crashes when popping navigators manually #2952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -16,7 +16,7 @@ import 'typedefs.dart'; | |||
|
|||
/// GoRouter implementation of [RouterDelegate]. | |||
class GoRouterDelegate extends RouterDelegate<RouteMatchList> | |||
with PopNavigatorRouterDelegateMixin<RouteMatchList>, ChangeNotifier { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We missed this when we refactor the pop. PopNavigatorRouterDelegateMixin is no longer needed since we override poproute directly
@@ -1012,6 +1012,80 @@ void main() { | |||
]); | |||
}); | |||
|
|||
testWidgets('Can manually pop root navigator and display correct url', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also add a test case that pop multiple times?
I think this PR would fix flutter/flutter#117431 but just want to make sure of it.
I added a test case for it in this PR: #2989 but since it's close, I'd like to add it in this PR at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added on pop twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ;)
I have no right to approve the PR but everything looks good to me.
#2989 could be added to the issue list since it's a potential fix for it as well. |
d3a7a4d
to
9b2225b
Compare
looks like this is blocked on #2977 |
This issue is also fixed with this pr. |
9b2225b
to
2dec4a9
Compare
fixes flutter/flutter#116784
fixes flutter/flutter#116769
fixes flutter/flutter#117431
The issue is that the app bar will pop the root navigator and skipping the navigator in the shellroute, and the goRouter only expect the RouteMatchList to be popped start from the last RouteMatch. This pr fixes it so that it can handle the case where developer may manually pop any navigator.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.