diff options
author | Mackinnon Buck <mackinnon.buck@gmail.com> | 2022-11-04 06:12:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 06:12:19 +0300 |
commit | cf5bfa197fdaba04576bedb8352707321804b6ac (patch) | |
tree | 5bdba48b1b9ab1394cc68defbd970a720120b84c | |
parent | f490fe4b6def8e967897d019a5dc5f03b3a7cb1e (diff) |
Catch JSDisconnectedException during disposal (#44800) (#44806)
-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 + } } } } |