Watch reactivity not guarantee when using with vue router props pass in compare to route.params change #12517
Unanswered
trchopan
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary:
Affected version: v3.2.45
Issue: props pass in by router, props update not guarantee before route change. Some case the route change happens before props update.
Detail:
During development of application that use watch function to detect change of vue route.params we experience a delay in the change of
props
passed in by the vue-router.Here is the code:
Vue router file
router/index.ts
Composable for getting the project name from route
useCurrentProject.ts
DemoTestView.vue
With the code above the
props.environment
inside thewatch(route, ...)
function is not updated.During investigation the code in the component run
watch(route, ...)
thenwatch(props, ...)
after.Additionally, I'm in version v3.2.45, we find out that when using vue v3.3.11 the
watch(props, ...)
behave as expected and run before the route change but could not find the related behavior change.My question is: in version v3.2.45, does the watch function on route reactive run before the passed in props change or the order is not guarantee?
Beta Was this translation helpful? Give feedback.
All reactions