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

"oldVNode is undefined" when combining reactive and non-reactive values in template's condition #12410

Open
SergeiMinaev opened this issue Nov 15, 2024 · 1 comment · May be fixed by #12411
Open
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.

Comments

@SergeiMinaev
Copy link

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNqNVGFP2zAQ/Ssnf0mqlnSs2xdoqm0MCabBpsH4gtEwyaU1pHZkOylT1f++s92WIlVoUlXFd++e352fvWSfmybrWmRHbGwLIxsHFl3bTLiS80YbB0so9LxpHZYD0OpCtyp8GqxgBZXRc0ioPuGKq0Ir6whOEMg9In3fO4bhENwMAY3RBmaiaVBZkNUaNwn0wmB5I+oWI6PHWyeMe+HcxeRweLzJlMKhpcjtHYW42ipM0x7kE2gbD/jqQWmvFyBVqwontXqdgyVXABVJTGt0oPJ3x6DGI/rr99dJiJvdqjvaT+ECfGnay5y+ckaqaer5AVZc0W88jOOkQdLC4bypCU0rgLGfrqc7h4Ww4MxfKganQRQziR3CA85EJ0nKYoYGgZo6MChINOViv1E6SBVGdXZ98T0yUkEM3Yfp3hMVjY4KHuR0ioZSQvnczjTvs6BpGEVttZ3pBUkxAyhqWTwFgUQbWInnoXWOJliI1hI5cSa6Lm8udUmaSJ0qsZIKyySeemSkI/cUUkknRb1V2IUjpar/lrje/FNQlnMWiPp9ziYnwVLSHsHS29YvVqvxMBbsK052PJBMfsephtXrqlJ20B3IKk/2ujZZD22NIxflyeaAwoElExIUIl4PoSLt+ms83PqDDZiz5OxKTrNHqxXdy+A93+W8kTWaH403r+WMmoy7cibqWi++hZgzLQ428WKGxdOe+KN99jHOfhq0aDrkbJujazdFF9OnV5f4TN/b5FyXbU3oN5K/0Oq69Roj7Au5gWTv4ILa8/C6kK+u7emzoydh05QXGq5RwHNGj8vJG62/yB1lHzbXj6b4h8zrOWmAo+xjdjhiq39PRqoJ

Steps to reproduce

Create count = ref(0);
Create non-reactive empty array;
Fill the array in onMounted();
Create template, where non-reactive array displays if count is bigger than some value.
This condition must be falsy at the start.
Increase the count to make the condition true and oldVNode is undefined will happens.

What is expected?

I was experimenting with vue's reactive system and trying to achieve behavior where non-reactive dates displays in the HTML when the count becomes bigger than comparedValue.

What is actually happening?

Increasing the count causes an oldVNode is undefined error if the initial count value is bigger than comparedValue at the start.

System Info

Firefox 131, Chrome 130

Any additional comments?

I understand that the way I doing it is not recommended, but the error looks strange.

@noootwo
Copy link
Contributor

noootwo commented Nov 16, 2024

This issue seems to occur because the div generated by v-for is identified and wrapped inside a STABLE_FRAGMENT, and at this point, the dynamicChildren array in this vnode has a length of 0. However, when the ref count changes, the newly generated vnode contains child nodes in dynamicChildren. This causes an error during the subsequent patch process.

But I'm not sure what the expected result is. Should this be marked as a non-stable fragment during compilation? Or should we add more case handling during the patch process?

If this is indeed a bug, I can help resolve it.

@edison1105 edison1105 added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants