diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 775f8b45..678cf754 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -21,13 +21,19 @@ export const RouterSymbol: InjectionKey = Symbol() // matter and is only passed to support same-host hrefs. const fakeHost = `http://a.com` +const notFoundPageData: PageData = { + relativePath: '', + title: '404', + description: 'Not Found', + headers: [], + frontmatter: {}, + lastUpdated: 0 +} + const getDefaultRoute = (): Route => ({ path: '/', component: null, - // this will be set upon initial page load, which is before - // the app is mounted, so it's guaranteed to be available in - // components. We just need enough data for 404 pages to render. - data: { frontmatter: {} } as any + data: notFoundPageData }) interface PageModule { @@ -123,15 +129,7 @@ export function createRouter( latestPendingPath = null route.path = pendingPath route.component = fallbackComponent ? markRaw(fallbackComponent) : null - // reset page data - route.data = { - relativePath: '', - title: '404', - description: 'Not Found', - headers: [], - frontmatter: {}, - lastUpdated: 0 - } + route.data = notFoundPageData } } }