Skip to content

Commit 1f760bd

Browse files
committed
fix(vue-router): react to provider context changes
1 parent e3a20b8 commit 1f760bd

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

‎packages/vue-router/src/RouterProvider.tsx‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ export const RouterContextProvider = Vue.defineComponent({
2121
const router = props.router as AnyRouter
2222
const restAttrs = attrs
2323

24-
// Allow the router to update options on the router instance
25-
router.update({
26-
...router.options,
27-
...restAttrs,
28-
context: {
29-
...router.options.context,
30-
...(restAttrs.context || {}),
31-
},
32-
})
33-
3424
// Provide router to all child components
3525
provideRouter(router)
3626

3727
return () => {
28+
// Allow the router to update options on the router instance
29+
router.update({
30+
...router.options,
31+
...restAttrs,
32+
context: {
33+
...router.options.context,
34+
...(restAttrs.context || {}),
35+
},
36+
})
37+
3838
// Get child content
3939
const childContent = slots.default?.()
4040

@@ -90,10 +90,7 @@ export const RouterProvider = Vue.defineComponent({
9090
} & Record<string, any>,
9191
): Vue.VNode
9292
new (): {
93-
$props: {
94-
router: AnyRouter
95-
routeTree?: AnyRouter['routeTree']
96-
}
93+
$props: RouterProps<AnyRouter>
9794
}
9895
}
9996

0 commit comments

Comments
 (0)