You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I using "v-for" to render an list, every "instance" in the list has an "id",
I would like to use a symbol type to express my "id" , and fill my "id" into ":key".
Every thing is OK until my "id" has duplicate(Example: push same "instance" into list twice by mistake)
In function "checkDuplicateKeys", when Vue detected duplicate key, it will log a warning, the warnning code is :
"warn(("Duplicate keys detected: '"key"'. This may cause an update error."),vnode.context);"
When the file "key" is symbol type, the browser will throw an error because jointing a symbol value with string, and then byebye my application.
I check the document, It didn't tell us that we can use an symbol into key, so I think it is not a bug.
So, could you please support symbol type in list rendering?
It was also not clear for me that symbols as keys are supported. Untill I searched github and found it's explicitly supported since v2.5.12.
I think documentation should be updated and say that key can be number | string | symbol. Also console warning [Vue warn]: Avoid using non-primitive value as key, use string/number value instead. should be changed to [Vue warn]: Avoid using non-primitive value as key, use string/number/symbol value instead.
Then it will be more obvious that this is supported, and not just "happens to work by accident".
What problem does this feature solve?
When I using "v-for" to render an list, every "instance" in the list has an "id",
I would like to use a symbol type to express my "id" , and fill my "id" into ":key".
Every thing is OK until my "id" has duplicate(Example: push same "instance" into list twice by mistake)
In function "checkDuplicateKeys", when Vue detected duplicate key, it will log a warning, the warnning code is :
When the file "key" is symbol type, the browser will throw an error because jointing a symbol value with string, and then byebye my application.
I check the document, It didn't tell us that we can use an symbol into key, so I think it is not a bug.
So, could you please support symbol type in list rendering?
What does the proposed API look like?
The text was updated successfully, but these errors were encountered: