-
Notifications
You must be signed in to change notification settings - Fork 29.3k
fix navigator observer announcement order #57605
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
@goderbauer This is somehow blocking the hero refactor since it touches the navigator observer |
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.
nit: maybe call this flushObserverNotifications? (similarly to the _flushRouteAnnouncement below).
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.
As an idea: maybe use a polymorphic approach:
- remove this enum
- have an abstract
void notify(List<Observers> observers)
on _NavigatorObservation - have subclasses for the various actions that implement the correct notification dispatch for the observation.
That also avoids the big switch below
ready for another look |
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.
LGTM
* fix navigator observer announcement order * addressing review comments * update * fix analyzer
Description
The navigator refactor accidentally changes the contract of navigator observer. If there are multiple route added in one history update (for example adding initial routes), the observer will receive the notifications from top-most route to bottm-most routes. It is the opposite of the order before the navigator observation.
This pr fixes it.
Related Issues
Fixes #57407 (comment)
Tests
I added the following tests:
See files
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.