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

Commit 6903125

Browse files
committed
Skip router render meanwhile there is no outlet
1 parent 9242d1b commit 6903125

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/router/index.ts

+15-11
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,24 @@ import { routes } from './routes';
1212

1313
const router = new Router();
1414

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

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

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

0 commit comments

Comments
 (0)