Skip to content

Commit

Permalink
chore: fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Sep 14, 2023
1 parent 3a3b8d6 commit 2ac78bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/client/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ declare module 'vue-router' {
*
* @internal only for internal use
*/
_data: PageData
_data?: PageData
}
}
4 changes: 2 additions & 2 deletions packages/client/src/setupGlobalComputed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ export const setupGlobalComputed = (
// load page data from route meta
const pageData = computedWithControl(
routePath,
() => router.currentRoute.value.meta._data,
() => router.currentRoute.value.meta._data!,
)
// handle page data HMR
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
__VUE_HMR_RUNTIME__.updatePageData = (data: PageData) => {
pagesData.value[data.key] = () => Promise.resolve(data)
if (data.key === router.currentRoute.value.meta._data.key) {
if (data.key === router.currentRoute.value.meta._data?.key) {
router.currentRoute.value.meta._data = data
pageData.trigger()
}
Expand Down

0 comments on commit 2ac78bd

Please sign in to comment.