From 28eaa3b04ab71674330151d2a9b79d52c382e71e Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Tue, 22 Feb 2022 10:15:03 +0530 Subject: [PATCH] fix: reset page data on 404 (#497) --- src/client/app/router.ts | 9 +++++++++ src/client/theme-default/components/LastUpdated.vue | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index f7c2a3973af..775f8b45fc7 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -123,6 +123,15 @@ 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 + } } } } diff --git a/src/client/theme-default/components/LastUpdated.vue b/src/client/theme-default/components/LastUpdated.vue index f495a0837d6..7adf72229ba 100644 --- a/src/client/theme-default/components/LastUpdated.vue +++ b/src/client/theme-default/components/LastUpdated.vue @@ -7,7 +7,7 @@ const { theme, page } = useData() const hasLastUpdated = computed(() => { const lu = theme.value.lastUpdated - return lu !== undefined && lu !== false + return lu !== undefined && lu !== false && page.value.lastUpdated !== 0 }) const prefix = computed(() => {