diff options
author | Mackinnon Buck <mackinnon.buck@gmail.com> | 2022-10-31 23:17:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-31 23:17:46 +0300 |
commit | 8dc432556c937465edb2cdff4ab2ad7cbb16bd92 (patch) | |
tree | 16e268a0ebe80af6284af1e23b582a9f91a6c160 | |
parent | 53b0980df09b75cfd3483e15fc537f6eae1d5313 (diff) |
Catch JSDisconnectedException during disposal (#44800)
-rw-r--r-- | src/Components/Web/src/Routing/NavigationLock.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Components/Web/src/Routing/NavigationLock.cs b/src/Components/Web/src/Routing/NavigationLock.cs index e8b5566531..622ab43a18 100644 --- a/src/Components/Web/src/Routing/NavigationLock.cs +++ b/src/Components/Web/src/Routing/NavigationLock.cs @@ -107,7 +107,14 @@ public sealed class NavigationLock : IComponent, IHandleAfterRender, IAsyncDispo if (_confirmExternalNavigation) { - await JSRuntime.InvokeVoidAsync(NavigationLockInterop.DisableNavigationPrompt, _id); + try + { + await JSRuntime.InvokeVoidAsync(NavigationLockInterop.DisableNavigationPrompt, _id); + } + catch (JSDisconnectedException) + { + // If the browser is gone, we don't need it to clean up any browser-side state + } } } } |