Skip to content
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

使用v-if渲染的组件内部watch受到其他v-show组件逻辑影响,导致watch触发行为异常 #9761

Closed
sqlyr opened this issue Dec 6, 2023 · 6 comments

Comments

@sqlyr
Copy link

sqlyr commented Dec 6, 2023

Vue version

3.3.10

Link to minimal reproduction

https://link.juejin.cn/?target=https%3A%2F%2Fgitee.com%2Fsqlyr%2Fvue-watch

Steps to reproduce

1、点击显示按钮
2、点击隐藏按钮
3、查看控制台输出
image

What is expected?

此处watch不触发

What is actually happening?

watch会错误触发
且使用注释中的写法不会触发该错误
image

System Info

No response

Any additional comments?

No response

@yangxiuxiu1115
Copy link
Contributor

playground

@sqlyr
Copy link
Author

sqlyr commented Dec 7, 2023

playground

tanks

@yyx990803
Copy link
Member

This is expected behavior, because watchers by default fire before render updates: https://vuejs.org/guide/essentials/watchers.html#callback-flush-timing

If you don't want it to fire, use a post-flush watcher.

@sqlyr
Copy link
Author

sqlyr commented Dec 7, 2023

This is expected behavior, because watchers by default fire before render updates: https://vuejs.org/guide/essentials/watchers.html#callback-flush-timing

If you don't want it to fire, use a post-flush watcher.

In the example code, Is inconsistent performance between using and not using v-show an expected behavior?

@yyx990803 yyx990803 reopened this Dec 7, 2023
@yyx990803
Copy link
Member

Closing as duplicate of #7030

@yyx990803 yyx990803 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants