Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

mdebbar
Copy link
Contributor

@mdebbar mdebbar commented Aug 3, 2021

When hot restart happens, instead of resetting browser history, we just remember which history mode was being used. Once the app starts again after the hot restart, we re-create the same history mode. Then:

  1. If the newly started app uses the same history mode: nothing will happen. The app will just start from where it left off.
  2. If the newly started app uses a different history mode: the previous history mode will be asked to tear down, then the new mode will setup itself.

Fixes flutter/flutter#79241

@mdebbar mdebbar added the platform-web Code specifically for the web engine label Aug 3, 2021
@mdebbar mdebbar requested a review from chunhtai August 3, 2021 21:54
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

MultiEntriesBrowserHistory(urlStrategy: _customUrlStrategy);
_browserHistory = _createDefaultBrowserHistory(_customUrlStrategy);
}
registerHotRestartListener(() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the hot restart teardown the history entries? If it does, we will lose all the url and state even if we memorize the mode. If it does not, I think we can just read the current state to determine whether that is a multi entry or single entry

@mdebbar mdebbar requested a review from chunhtai August 9, 2021 21:12
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

We need a test, the change lgtm

@mdebbar
Copy link
Contributor Author

mdebbar commented Aug 10, 2021

I'm relying on existing tests to catch any regression caused by this PR.

I also filed an issue to add an integration test. I need to figure out how to test hot restart on web.

@chunhtai
Copy link
Contributor

sounds good, I think we can write a simple test for createHistoryForExistingState before we have integration test coverage

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@mdebbar mdebbar merged commit 5e515af into flutter:master Aug 13, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 14, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 14, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 14, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 14, 2021
christopherfujino added a commit that referenced this pull request Sep 2, 2021
)

* 'Update Dart SDK to aa7d19d'

* [web] Don't reset history on hot restart (#27872)

* Makes scrollable to use main screen if the flutter view is not attached to a screen (#28110)

* Fix regression in system UI colors (#28206)

* update licenses golden

Co-authored-by: Mouad Debbar <[email protected]>
Co-authored-by: chunhtai <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
tneotia pushed a commit to BlueBubblesApp/engine that referenced this pull request Dec 9, 2021
…tter#28415)

* 'Update Dart SDK to aa7d19d'

* [web] Don't reset history on hot restart (flutter#27872)

* Makes scrollable to use main screen if the flutter view is not attached to a screen (flutter#28110)

* Fix regression in system UI colors (flutter#28206)

* update licenses golden

Co-authored-by: Mouad Debbar <[email protected]>
Co-authored-by: chunhtai <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
filmil pushed a commit to filmil/engine that referenced this pull request Apr 21, 2022
@mdebbar mdebbar deleted the history_hot_restart branch January 17, 2023 18:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes cp: 2.5 needs tests platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WEB] Losing url state after hot restart
3 participants