-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Duplicate key for transition group fragment when child has v-if #5761
Comments
Not completely sure what you want to say, @coder-hxl . |
I don’t know how the key calculation for the |
I guess we need to clarify expect behaviour first, is it supposed to be: ??
My pull request 5779 results in following result:
It completely re-calculates keys based on index position in the list and ignores number type keys from |
Off the top of my head I would say your solution sounds perfectly reasonable. |
children component with v-if can be seted explicit key no warn |
Ah, thank you for the tip, @iwusong. Setting a key on the |
explicit key on child v-if node is nice workaround, just need to be aware that a custom key of "number type" on v-if could still be duplicated with other default index key because the fundamental issue is caused by "number type keys on v-if node". So using types other than number should be good enough 👍 |
Version
3.2.33
Reproduction link
sfc.vuejs.org/
Steps to reproduce
Have a
<template v-for>
inside a<TransitionGroup>
, with multiple children and one of those children hasv-if
. For example:What is expected?
Here the keys should be
A0
,A1
andB0
.What is actually happening?
But instead we get
A0
,A0
andB0
.Without the
v-if
everything works correctly and we getA0
,A1
,B0
andB1
.In the reproduction I have used a component for the children, so the generated key is easily visible in the devtools.
Related commit: 4311ddd
Related issues: #4718, #5360, #5392
The text was updated successfully, but these errors were encountered: