-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Migration guide section about v-if key #379
Comments
@Aurelius333 thank you for reporting this! I was writing |
In case it's helpful, here's my understanding of how it works as of the latest release. As of v3.0.0-rc.6, it seems like it’s okay to provide explicit keys on It seems like there are two breaking changes involved here. These could be two different sections in the migration guide, or maybe they could be combined into one section about changes to Change 1:
|
@Aurelius333 would you mind creating a pull request with these changes or would you prefer me to create it? 😅 |
@NataliaTepluhina I'd be happy to create a pull request. |
* feat: add migration guide section about "key" attribute changes Fix #379 * undo formatting changes in config.js
Edit: It seems like the behavior has changed on the master branch since I posted this yesterday, so the following description is out of date. I think it's still a breaking change, so the migration guide might still need a section on this. However, it might be good to wait a little bit before working on that, since it seems possible that the behavior could change again before the next release.
I can't find anything about this in the migration guide, but it seems to be a breaking change.
Example A
Vue 2
In v2, it was common to use
key
s onv-if
,v-else
, andv-else-if
. For example:Vue 3
In v3, this produces an compiler error because
key
s are automatically generated onv-if
,v-else
, andv-else-if
nodes. These keys can be removed:Example B
Vue 2
In v2, a
<template>
could not have akey
, so when using a<template v-for="...">
with a childv-if
/v-else
, you would place thekey
on both of the children:Vue 3
In v3, the previous example causes the
v-if
to not work properly, and it produces an error message. Because of Fragments, we can now put thekey
on the<template>
directly:Error message
This is the new error message for this problem in the master branch of vue-next. (This new message isn't released into a new version yet.)
References
The text was updated successfully, but these errors were encountered: