未验证 提交 17a11165 编写于 作者: C chunhtai 提交者: GitHub

Fixes hot restart correctly reset the browser history (#24377)

上级 c4a8de2a
......@@ -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;
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册