Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/web_ui/lib/src/engine/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
_browserHistory =
MultiEntriesBrowserHistory(urlStrategy: _customUrlStrategy);
}
registerHotRestartListener(() {
window.resetHistory();
});
}

final Object _windowId;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/web_ui/test/engine/history_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void testMain() {

tearDown(() async {
spy.tearDown();
await window.debugResetHistory();
await window.resetHistory();
});

test('basic setup works', () async {
Expand Down Expand Up @@ -262,7 +262,7 @@ void testMain() {

tearDown(() async {
spy.tearDown();
await window.debugResetHistory();
await window.resetHistory();
});

test('basic setup works', () async {
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/test/engine/navigation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/test/window_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void testMain() {
});

tearDown(() async {
await window.debugResetHistory();
await window.resetHistory();
window = null;
});

Expand Down