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.button.style.display = 'block';
this.reloadParagraph.style.display = 'none'; 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.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 { rejected(): void {
this.button.style.display = 'none'; this.button.style.display = 'none';
this.reloadParagraph.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.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>) { function listenForNavigationEvents(callback: (uri: string, intercepted: boolean) => Promise<void>) {
notifyLocationChangedCallback = callback;
if (hasRegisteredNavigationEventListeners) { if (hasRegisteredNavigationEventListeners) {
return; return;
} }
notifyLocationChangedCallback = callback;
hasRegisteredNavigationEventListeners = true; hasRegisteredNavigationEventListeners = true;
window.addEventListener('popstate', () => notifyLocationChanged(false)); window.addEventListener('popstate', () => notifyLocationChanged(false));
} }

View File

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

View File

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