Skip to content

Commit debb1b0

Browse files
committed
Fix for uninitialized JSRuntime
When we arrive from an External Page into a Page which has a NavigationManager and has a LocationChanging Event registered, Server Side Blazor would crash because of the uninitialized JSRuntime, during prerendering
1 parent 6fe7b6b commit debb1b0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Components/Server/src/Circuits/RemoteNavigationManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected override void NavigateToCore(string uri, bool forceLoad)
100100
/// <inheritdoc />
101101
protected override void SetHasLocationChangingListeners(bool value)
102102
{
103-
_jsRuntime.InvokeAsync<object>(Interop.SetHasLocationChangingListeners, value);
103+
_jsRuntime?.InvokeAsync<object>(Interop.SetHasLocationChangingListeners, value);
104104
}
105105

106106
private static class Log

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webassembly.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)