Blazor fixes (#13377)

* Remove incorrect comment from template. Fixes #13331
* Fix reload button. Fixes #13370
* Fix navigation after reconnection. Fixes #13371
* Auth template fixes. Fixes #13374 and #13375
This commit is contained in:
Steve Sanderson 2019-08-24 00:48:24 +02:00 committed by Doug Bunting
parent cfcffd8251
commit b16a26d50b
6 changed files with 17 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -77,11 +77,13 @@ export class DefaultReconnectDisplay implements ReconnectDisplay {
this.button.style.display = 'block';
this.reloadParagraph.style.display = 'none';
this.message.innerHTML = 'Reconnection failed. Try <a href>reloading</a> the page if you\'re unable to reconnect.';
this.message.querySelector('a')!.addEventListener('click', () => location.reload());
}
rejected(): void {
this.button.style.display = 'none';
this.reloadParagraph.style.display = 'none';
this.message.innerHTML = 'Could not reconnect to the server. <a href>Reload</a> the page to restore functionality.';
this.message.querySelector('a')!.addEventListener('click', () => location.reload());
}
}

View File

@ -17,12 +17,12 @@ export const internalFunctions = {
};
function listenForNavigationEvents(callback: (uri: string, intercepted: boolean) => Promise<void>) {
notifyLocationChangedCallback = callback;
if (hasRegisteredNavigationEventListeners) {
return;
}
notifyLocationChangedCallback = callback;
hasRegisteredNavigationEventListeners = true;
window.addEventListener('popstate', () => notifyLocationChanged(false));
}

View File

@ -1,14 +1,22 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
@*#if (OrganizationalAuth || IndividualAuth)
@*#if (!NoAuth)
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
#else
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
#endif*@
</Found>
<NotFound>
@*#if (!NoAuth)
<CascadingAuthenticationState>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</CascadingAuthenticationState>
#else
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
#endif*@
</NotFound>
</Router>

View File

@ -14,7 +14,6 @@
</head>
<body>
<app>
@* Remove the following line of code to disable prerendering *@
@(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
</app>