Fixes hot restart correctly reset the browser history (flutter/engine#24377)
This commit is contained in:
@@ -32,6 +32,9 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
|
||||
_browserHistory =
|
||||
MultiEntriesBrowserHistory(urlStrategy: _customUrlStrategy);
|
||||
}
|
||||
registerHotRestartListener(() {
|
||||
window.resetHistory();
|
||||
});
|
||||
}
|
||||
|
||||
final Object _windowId;
|
||||
@@ -86,12 +89,11 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
|
||||
}
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
Future<void> debugResetHistory() async {
|
||||
Future<void> resetHistory() async {
|
||||
await _browserHistory?.tearDown();
|
||||
_browserHistory = null;
|
||||
|
||||
// Reset the globals too.
|
||||
_usingRouter = false;
|
||||
_isUrlStrategySet = false;
|
||||
_customUrlStrategy = null;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ void testMain() {
|
||||
|
||||
tearDown(() async {
|
||||
spy.tearDown();
|
||||
await window.debugResetHistory();
|
||||
await window.resetHistory();
|
||||
});
|
||||
|
||||
test('basic setup works', () async {
|
||||
@@ -262,7 +262,7 @@ void testMain() {
|
||||
|
||||
tearDown(() async {
|
||||
spy.tearDown();
|
||||
await window.debugResetHistory();
|
||||
await window.resetHistory();
|
||||
});
|
||||
|
||||
test('basic setup works', () async {
|
||||
|
||||
@@ -28,7 +28,7 @@ void testMain() {
|
||||
|
||||
tearDown(() async {
|
||||
_strategy = null;
|
||||
await engine.window.debugResetHistory();
|
||||
await engine.window.resetHistory();
|
||||
});
|
||||
|
||||
test('Tracks pushed, replaced and popped routes', () async {
|
||||
|
||||
@@ -33,7 +33,7 @@ void testMain() {
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
await window.debugResetHistory();
|
||||
await window.resetHistory();
|
||||
window = null;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user