-
Notifications
You must be signed in to change notification settings - Fork 6k
update browser history switching #23471
Conversation
|
A friendly bump |
mdebbar
left a comment
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.
The code changes look good to me. But I'm not sure if we should keep the assert or make it a warning. @johnpryan thoughts?
|
If this were to display a warning instead, would the exception from flutter/flutter#72093 get thrown eventually? If that's the case then an assert makes more sense to me, since it's failing earlier. On the other hand if the exception from flutter/flutter#72093 isn't guaranteed to happen, then a warning might make more sense. |
If we want to make it a warning, we would change the line that throws this error to print warning instead. The current situation is that app can ignore this conflict where app uses both Nav1 and Nav2 in the same time. It can complete ignore nav1 update and pretend there is only nav2 update. We don't forbid user from using both nav1 and nav2 together, but we discourage that. The difference between throwing assertion vs printing warning is that how strong we discourage that. If we print warning, the app runs fine on both debug and release mode, it will only print warning out in the console. and people may miss if they do not read it carefully. If we throw, the app runs fine in release mode, but it will crash in debug mode. |
|
Thanks, an assertion sounds right to me here. |
Description
Previously we throw assertion if the browser receives nav2 updates after it has received nav1 updates, and browser will remain nav1 through out its life time. This means the browser favor nav1 over nav2. This PR updates it so that it will only throw if it receives nav1 update after it has received nav2 update.
In case where users nested a MaterialApp.router inside a MaterialApp, the app will throw assertion error for nav1 update in debug mode, and drop nav1 update silently in release mode.
Related Issues
flutter/flutter#72093
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.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.