From c27d107ba6c29a443c4acbea13cdcb93f0ec95d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdo=CC=81n=20Rodri=CC=81guez=20Davila?= Date: Wed, 14 Oct 2020 11:53:01 +0200 Subject: [PATCH] Skip router render meanwhile there is no outlet --- src/router/index.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 37684497..0e353563 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -12,20 +12,24 @@ import { routes } from './routes.js'; const router = new Router(); -router.setRoutes([ - // Redirect to URL without trailing slash - { - path: '(.*)/', - action: (context, commands) => { - const newPath = context.pathname.slice(0, -1); - return commands.redirect(newPath); - } - }, - ...routes -]); +router.setRoutes( + [ + // Redirect to URL without trailing slash + { + path: '(.*)/', + action: (context, commands) => { + const newPath = context.pathname.slice(0, -1); + return commands.redirect(newPath); + } + }, + ...routes + ], + true +); export const attachRouter = (outlet: HTMLElement) => { router.setOutlet(outlet); + router.render(window.location, true); }; export const urlForName = (name: string, params?: Params) => {