Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 24db0a6

Browse files
committed
Skip router render meanwhile there is no outlet
1 parent 586c63e commit 24db0a6

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/router/index.ts

+14-10
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@ import type { Params } from '@vaadin/router';
1313

1414
const router = new Router();
1515

16-
router.setRoutes([
17-
// Redirect to URL without trailing slash
18-
{
19-
path: '(.*)/',
20-
action: (context, commands) => {
21-
const newPath = context.pathname.slice(0, -1);
22-
return commands.redirect(newPath);
16+
router.setRoutes(
17+
[
18+
// Redirect to URL without trailing slash
19+
{
20+
path: '(.*)/',
21+
action: (context, commands) => {
22+
const newPath = context.pathname.slice(0, -1);
23+
return commands.redirect(newPath);
24+
},
2325
},
24-
},
25-
...routes,
26-
]);
26+
...routes,
27+
],
28+
true
29+
);
2730

2831
export const attachRouter = (outlet: HTMLElement) => {
2932
router.setOutlet(outlet);
33+
router.render(window.location, true);
3034
};
3135

3236
export const urlForName = (name: string, params?: Params) => {

0 commit comments

Comments
 (0)