Skip to content
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

Merged
merged 3 commits into from
Jan 15, 2020

Conversation

mdebbar
Copy link
Contributor

@mdebbar mdebbar commented Jan 13, 2020

Helps with some routing-related issues in Flutter Gallery's Shrine and other apps (flutter/flutter#43982 (comment)).

@mdebbar mdebbar added the platform-web Code specifically for the web engine label Jan 13, 2020
@mdebbar mdebbar self-assigned this Jan 13, 2020
@auto-assign auto-assign bot requested a review from flar January 13, 2020 23:17
@mdebbar mdebbar removed the request for review from flar January 13, 2020 23:25
@override
String get defaultRouteName => _browserHistory.currentPath;
String get defaultRouteName => _defaultRouteName ??= _browserHistory.currentPath;
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@mdebbar mdebbar added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jan 14, 2020
@fluttergithubbot fluttergithubbot merged commit 09d892b into flutter:master Jan 15, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 16, 2020
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Jan 16, 2020
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
NoamDev pushed a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
NoamDev added a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
filmil pushed a commit to filmil/engine that referenced this pull request Mar 13, 2020
@mdebbar mdebbar deleted the window_default_route_name branch April 15, 2021 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes platform-web Code specifically for the web engine waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
6 participants