File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change 11import { pagesComponents } from '@internal/pagesComponents'
2- import type { PageData } from '@vuepress/shared'
32import { removeEndingSlash } from '@vuepress/shared'
43import {
54 createMemoryHistory ,
@@ -33,23 +32,13 @@ export const createVueRouter = (): Router => {
3332 } ,
3433 } )
3534
36- // ensure page data and page component have been loaded in beforeResolve hook,
37- // but do not assign page data immediately to avoid mismatching between page data and route path.
38- let pendingPageData : PageData
39- let pendingToPath : string
4035 router . beforeResolve ( async ( to , from ) => {
4136 if ( to . path !== from . path || from === START_LOCATION ) {
42- ; [ pendingPageData ] = await Promise . all ( [
37+ // ensure page data and page component have been loaded
38+ ; [ pageData . value ] = await Promise . all ( [
4339 resolvers . resolvePageData ( to . name as string ) ,
4440 pagesComponents [ to . name as string ] ?. __asyncLoader ( ) ,
4541 ] )
46- pendingToPath = to . path
47- }
48- } )
49- // instead, assign page data in afterEach hook
50- router . afterEach ( ( to , from ) => {
51- if ( to . path !== from . path && to . path === pendingToPath ) {
52- pageData . value = pendingPageData
5342 }
5443 } )
5544
You can’t perform that action at this time.
0 commit comments