From be6d201b54919654e6cc64cc5a6b04b0aac19662 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 4a45c994..c06e3cf3 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -12,20 +12,24 @@ import { routes } from './routes'; 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) => {