-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
watch()
does not work after building for production using npm run build
#7688
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
Comments
Creating the minimal reproduction, I've learned that it has something to do with:
|
|
This seems to be unrelated to #5707. The problem here is that the component's Here's what I could find out quickly: The renderer triggers a re-render of the HomeView component, because in the component's vnode, the prop has been updated. However the Addign this to onBeforeUpdate(() => {
const vnodeProps = getCurrentInstance()?.vnode.props
console.log('updating...', { ...props }, { ...vnodeProps })
}) results in this console entry: So, seems to be a problem with Suspense, maybe in combination with /cc @posva does this look familiar to some problem you have seen before? |
That only happens when |
Have you been able to reproduce it @LinusBorg ? Is this now a confirmed bug? |
Yes |
There are other bugs with Suspense and keep alive that appear because the entering component renders before the leaving component. There are some open issues in vue router about this. But I don't recall any problem with a different behavior between dev and prod |
Got it. when calling core/packages/runtime-core/src/renderer.ts Line 1231 in 1d09540
I think we would need to change registerDep(instance, setupRenderEffect, optimized = false) { Not sure how to write a proper test for this though. |
Thank you for triaging this and finding a fix so quickly, much appreciated @LinusBorg ❤️ |
The difference of behavior between dev and production is caused by the |
yes |
Vue version
3.2.45
Link to minimal reproduction
will add zip file to this issue
Steps to reproduce
npm run dev
npm run build
and serve usingnpx http-server dist
What is expected?
watch callback gets called
What is actually happening?
watch callback does not get called
System Info
No response
Any additional comments?
creating this issue to bring attention back to (#5707)
looks like the bug affects both
watch()
andwatchEffect()
The text was updated successfully, but these errors were encountered: