Skip to content

Commit

Permalink
Catch JSDisconnectedException during disposal (#44800)
Browse files Browse the repository at this point in the history
  • Loading branch information
MackinnonBuck committed Oct 31, 2022
1 parent 53b0980 commit 8dc4325
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Components/Web/src/Routing/NavigationLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,14 @@ async ValueTask IAsyncDisposable.DisposeAsync()

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
}
}
}
}

0 comments on commit 8dc4325

Please sign in to comment.