File tree 1 file changed +2
-13
lines changed
1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change 1
1
import { pagesComponents } from '@internal/pagesComponents'
2
- import type { PageData } from '@vuepress/shared'
3
2
import { removeEndingSlash } from '@vuepress/shared'
4
3
import {
5
4
createMemoryHistory ,
@@ -33,23 +32,13 @@ export const createVueRouter = (): Router => {
33
32
} ,
34
33
} )
35
34
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
40
35
router . beforeResolve ( async ( to , from ) => {
41
36
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 ( [
43
39
resolvers . resolvePageData ( to . name as string ) ,
44
40
pagesComponents [ to . name as string ] ?. __asyncLoader ( ) ,
45
41
] )
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
53
42
}
54
43
} )
55
44
You can’t perform that action at this time.
0 commit comments