static: fix behaviour on initial load when no route is given

This commit is contained in:
Jens Langhammer 2020-11-22 23:48:34 +01:00
parent 5da8caf0d4
commit 3cfe144394
3 changed files with 4 additions and 3 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

@ -67,6 +67,8 @@ export class RouterOutlet extends LitElement {
let activeUrl = window.location.hash.slice(1, Infinity); let activeUrl = window.location.hash.slice(1, Infinity);
if (activeUrl === "") { if (activeUrl === "") {
activeUrl = this.defaultUrl!; activeUrl = this.defaultUrl!;
window.location.hash = `#${activeUrl}`;
return;
} }
ROUTES.forEach((route) => { ROUTES.forEach((route) => {
let selectedRoute: Route | null = null; let selectedRoute: Route | null = null;
@ -77,7 +79,6 @@ export class RouterOutlet extends LitElement {
console.log( console.log(
`passbook/router: route "${activeUrl}" not defined, defaulting to shell` `passbook/router: route "${activeUrl}" not defined, defaulting to shell`
); );
window.location.hash = `#${activeUrl}`;
selectedRoute = { selectedRoute = {
url: RegExp(""), url: RegExp(""),
element: html`<pb-site-shell url=${activeUrl} element: html`<pb-site-shell url=${activeUrl}