-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[web] Freeze window.defaultRouteName #15565
[web] Freeze window.defaultRouteName #15565
Conversation
@override | ||
String get defaultRouteName => _browserHistory.currentPath; | ||
String get defaultRouteName => _defaultRouteName ??= _browserHistory.currentPath; |
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.
Should it be frozen on construction, or when the browser window opens rather than on first access?
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 want to delay the initialization of defaultRouteName
a bit so that the app has time to initialize the engine and set locationStrategy
which is used by _browserHistory
to get the current path.
But once the app gets the value of the default route name, it shouldn't change after that.
@@ -99,8 +99,10 @@ class EngineWindow extends ui.Window { | |||
/// Simulates clicking the browser's back button. | |||
Future<void> webOnlyBack() => _browserHistory.back(); | |||
|
|||
String _defaultRouteName; |
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.
It took me a while to realize (found the ??=
in the code) that this is lazy-initialized and cached route name. I think a comment would be useful.
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.
Done.
flutter/engine@be20fb6...09d892b git log be20fb6..09d892b --first-parent --oneline 2020-01-15 mouad.debbar@gmail.com [web] Freeze window.defaultRouteName (flutter/engine#15565) 2020-01-15 hterkelsen@users.noreply.github.com Upgrade to CanvasKit 0.11 (flutter/engine#15677) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jimgraham@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
This reverts commit 943f3cd.
Helps with some routing-related issues in Flutter Gallery's Shrine and other apps (flutter/flutter#43982 (comment)).