Skip to content

Fix NavigationLock throwing a JSDisconnectedException on browser close in Blazor Server #44800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

MackinnonBuck
Copy link
Member

Fix NavigationLock throwing a JSDisconnectedException on browser close in Blazor Server

Fixes an issue where in Blazor Server, if the browser gets closed while a <NavigationLock ConfirmExternalNavigation="true" /> is actively rendered, a JSDisconnectedException gets thrown.

Description

This PR fixes the issue by catching and ignoring the JSDisconnectedException, which is the recommended pattern for attempting to perform JS interop on component disposal.

Fixes #44795

@MackinnonBuck MackinnonBuck requested a review from a team as a code owner October 31, 2022 17:29
@TanayParikh TanayParikh added the area-blazor Includes: Blazor, Razor Components label Oct 31, 2022
@MackinnonBuck MackinnonBuck merged commit 8dc4325 into main Oct 31, 2022
@MackinnonBuck MackinnonBuck deleted the mbuck/fix-navigation-lock-disposal branch October 31, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NavigationLock throws uncaught JSDisconnectedException on Blazor Server
2 participants