New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(client): avoid updating routeLocale #1253
Conversation
watch( | ||
() => router.currentRoute.value.path, | ||
(newValue) => { | ||
if (newValue !== routePath.value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the if
branch necessary?
BTW, could you check if the computedWithControl
from vueuse is helpful for this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the if branch necessary?
It's not, removed
BTW, could you check if the computedWithControl from vueuse is helpful for this case?
Tried, but seems not working, seems like the same as the original, as long as route object change, computed is triggered.
I think that using computedWithControl
should be the same as
const routePath = computed(()=> router.currentRoute.value.path)
routePath and everything depending on it will still be triggered while scrolling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked the source code of computedWithControl
. It's using watch
inside. 🤔
How did you try it? Something like this? (Just curious and discuss, we may not introduce vueuse into client package)
const routePath = computedWithControl(
()=> router.currentRoute.value.path,
()=> router.currentRoute.value.path
)
No description provided.