Skip to content

Commit 8dc4325

Browse files
Catch JSDisconnectedException during disposal (#44800)
1 parent 53b0980 commit 8dc4325

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Components/Web/src/Routing/NavigationLock.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ async ValueTask IAsyncDisposable.DisposeAsync()
107107

108108
if (_confirmExternalNavigation)
109109
{
110-
await JSRuntime.InvokeVoidAsync(NavigationLockInterop.DisableNavigationPrompt, _id);
110+
try
111+
{
112+
await JSRuntime.InvokeVoidAsync(NavigationLockInterop.DisableNavigationPrompt, _id);
113+
}
114+
catch (JSDisconnectedException)
115+
{
116+
// If the browser is gone, we don't need it to clean up any browser-side state
117+
}
111118
}
112119
}
113120
}

0 commit comments

Comments
 (0)