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

Key warning shouldn't be shown for transition keys #6126

Closed
bundyo opened this issue Jul 16, 2017 · 2 comments · Fixed by #6127
Closed

Key warning shouldn't be shown for transition keys #6126

bundyo opened this issue Jul 16, 2017 · 2 comments · Fixed by #6127
Assignees

Comments

@bundyo
Copy link

bundyo commented Jul 16, 2017

Version

2.4.1

Reproduction link

https://jsfiddle.net/f3Lo2k0p/

Steps to reproduce

  1. Add :key binding in a transition

What is expected?

To not get a warning

What is actually happening?

Vue issues a warning:
"Avoid using non-primitive value as key, use string/number value instead."

However the key here is bound to a boolean property.

@LinusBorg
Copy link
Member

A boolean is not a string or a number, so technically, you are not doing what the warning asks you to do. ;)

Still, we should look into it and see that boo leans are fine too.

@posva posva self-assigned this Jul 16, 2017
@posva
Copy link
Member

posva commented Jul 16, 2017

FYI, you can turn the boolean into a number by prepending +:

<div :key="+isEditing">

I guess adding it to the warning is enough but we could also make isPrimitive check if the vaule is a boolean

posva added a commit to posva/vue that referenced this issue Jul 17, 2017
yyx990803 pushed a commit that referenced this issue Jul 19, 2017
suppresses key warning for boolean values, closes #6126
yyx990803 pushed a commit that referenced this issue Jul 19, 2017
suppresses key warning for boolean values, closes #6126
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants