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

vue 3.2.38 latest version watcher bug #6609

Closed
jiashicheng opened this issue Sep 6, 2022 · 9 comments
Closed

vue 3.2.38 latest version watcher bug #6609

jiashicheng opened this issue Sep 6, 2022 · 9 comments

Comments

@jiashicheng
Copy link

Vue version

3.2.38

Link to minimal reproduction

https://sfc.vuejs.org/#eNqlUsFu00AQ/ZXRXuxIiVdtbiGpqBA3LiA4sRyMM25d7N1ld52oiiyBVAQVXLmgHlqpwAX+IPwNScupv8CsHUehqAipUSx5Zt88z3v7ZmxX62hSIhuwoU1Mph1YdKXeETIrtDIOZmAw7cI0dsl+V8knehw7HEMFqVEFBDQbrLH3VKFX/Yj7wlMHd4Rcz4VhZ7QDMyEB4hyNC7e3O3RedYRMS5m4TEnYQ0f/sLMJ6/cJAcD58vv54vzo18mryy+vF/OPizefJ7F0F5+OAB6r2Low+Pnj9OLk/fL46+XZh8Xb0+W3s5riav6u37+aHwdEVAk55I1cEkqFw0LntB9VAEOvHug3rPXcNfiyROt6eWbdSLBmPcF4A+YePeRrBtZljRu9ItbRgVWSvK2ViNWBFWzQaPM9csjXgu07p+2Ac5sm3rYDGymzx+ktMqV0WYER2qL33KipRUPEgnU3ODg1J2h6BuUYDZp/cV6D/sXracmiiqS0l3jLfOToAIvMPWqsfEBOwgjGmGYS71Pfhk+DTZuDZ3RLiZIEq5s+FiP/oTDw93dznLa22jjVC4XtdBdieygTCCVOH656HWhnr60W/rmLDww9/5OYXfsCYjhEy6Vabz5YpSmTunQw6RVqjDkFqT0XDG7KUvUbIThQTg==

Steps to reproduce

Sorry, I'm a Chinese. I speak Chinese later
应该是 解决 #2291 bug的时候,造成的问题;
务必引用vant组件,调用Toast () 可以复现
//子组件

<script setup> import { ref, watch, onUpdated } from 'vue' const emit = defineEmits(['change-add']) const newTodoText = ref('1234') onUpdated(() => { console.log('test-onUpdated'); }) watch(newTodoText, (nn, oo) => { emit('change-add', nn) }) </script>
Add a todo22 Add22

//父组件

<script setup> import { ref } from 'vue' import InputPhone from './InputPhone.vue'; import { Toast } from 'vant'; const todos = ref([ ]) let nextTodoId = 4 function addNewTodo2(dd) { todos.value.push({ id: nextTodoId++, title: dd }) console.log('234'); Toast('你看这里打印了几个?') } </script>

What is expected?

修复watch执行两遍的问题

What is actually happening?

watch执行两遍

System Info

No response

Any additional comments?

No response

@Jackllllll
Copy link

U provided the minimal reproduction! I try it and Watcher is called once

@vaas1993
Copy link

vaas1993 commented Sep 6, 2022

我也发现这个问题了,过来github找解决办法。。。3.2.26已经存在这个问题

@yanni4night
Copy link

Same issue, pre watcher triggered 2 times

@LinusBorg
Copy link
Member

LinusBorg commented Sep 6, 2022

When I run this SFC playground reproduction and enter "a" into the input, I get 2 alerts - one from the watch, one from the onUpdated() hook.

Both are expected. I don't see multiple watcher calls, I don't see anything else supsicious. What should I be looking for?

Those of you who say they can reproduce this: what browser are you using?

Edit: translating the chinese text tells me I have to use vant to reproduce, not the example in the playground?

Sounds like you need to a) open an issue with vant or b) find a way to reproduce the problem without vant. I don't see what we should be doing here.

@tazyong
Copy link

tazyong commented Sep 7, 2022

@LinusBorg like this, example

@vaas1993
Copy link

vaas1993 commented Sep 7, 2022

@LinusBorg like this, example

This may not be Vue's problem,Remove line 10 and try again

@LinusBorg
Copy link
Member

LinusBorg commented Sep 7, 2022

We don't have the capacity to debug vant, or arco-design.

Please open an issue with them.

Maybe they can verify it and create a reproduction that does not involve their big third party library, so we can actually evaluate the problem with Vue alone.

@LinusBorg
Copy link
Member

Seems #6614 successfully demonstrates the issue with Vue alone. Closing in favor of that issue

@github-actions github-actions bot locked and limited conversation to collaborators Sep 22, 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

7 participants