Closed
Labels
Description
Vue version
3.2.47
Link to minimal reproduction
Steps to reproduce
if I click toggleVisible many times,
- the
refDivSingletoggle between null and div - the
refCompSingletoggle between null and {} - the
refDivArr.lengthincrease more and more <-- error here - the
refCompArr.lengthtoggle between 3 and 0
if I use ref function, it don't get null

What is expected?
the refDivArr.length should toggle between 3 and 0, same as the refCompArr.length
What is actually happening?
the refDivArr.length increase more and more
System Info
No response
Any additional comments?
No response
Activity
[-]the div which has the ref attribute inside the v-for, when I v-if toggle them, the ref value increase more and more[/-][+]the div which has the ref attribute inside the v-for, when I v-if toggle them, the ref value.length increase more and more[/+]edison1105 commentedon Sep 19, 2023
a workaround:
<div v-for="(vv0, index0) in 3" :key="index0" ref="refDivArr"> +<div v-for="(vv0, index0) in 3" ref="refDivArr"> <CompB ref="refCompArr"></CompB> </div>hisland commentedon Sep 20, 2023
If I use ref function, it can not get
null, when bind toDIV@Alfred-Skyblue @edison1105reproduce link here:
https://play.vuejs.org/#eNqtVM2O0zAQfpUhHNJKoS3qLZsWWFgkkPgRIE65uMk09da1LdtJW0V5d8ZJk7YLLAe2h8ae+eabf9fBG60nVYlBHCQ2M1w7sOhKDYLJYpEGzqbBMpV8p5VxUIPBdUR/LHO8wgiU/KRK6TCPIFM7XbanPXPZBhpYG7WDkMjDgeAtgW5Pism0vXnvBEhlpqR1wO1PbvlKICy8s5EzJY5TuS4luVQSnCoKgSfMaAx1KuFsNKmYKL3psweiVDbex0BD1O/lO16NUMTA5HHc8vgQFJkIVYzCHhJGgIJCIIJrcx/+v+w95oIgmXZFppImDndaMId0BkhyXoF1R4FU9JUyOZoYXuoDEB/P4Tki3oBmec5lQYqZPrR9Afp50+W5bHV9UcNXEB7RhhBDKFUITZNMPfpkuCqdo2ReZ4JnW9/sy9oS/9U9mXZwMj77heoFX5Pl4DENhiw2yIuN88FStDfwe1Kay+2QBQAzhh37y4l8rQwxjapqFgGXOR5mY/rCnNxATAUmZd8mEg1UZN9N2hXIi8hf0s3dAL4qyXDuT8n0ok9JmxvYTGnM+xURaP2SUGu9klBBRGtDo7DmxeTeKkm71U5HGvgd4QLNF+2niKzibn69jgmh9h9bmZ/5qJdnG8y2f5DfWxqBmA5fDVo0FZV+0DlmCnSd+u77ZzzQeVDuVF76Rj2i/IbUodLH2MFuS5lT2Be4NtoP7VLTRP6wdweH0vZJ+UA9smnxaUAr7mv+t9TP4c4n89aOloWqOLwPT/c6PXiWUjlgRvSYLJZQN7Spj69pJpi15H1vmJ8nh9b9z7Q0vwBmNtrm
Alfred-Skyblue commentedon Sep 20, 2023
Fixed in #9240 @hisland
2840365628 commentedon Jul 23, 2024
#11424
请问这是否和我的问题有关
fix(compiler-core): preserve vnode lifecycle in stable v-for (vuejs#1…