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
Either check out the reproduction link above, OR follow these steps:
Make a list (array or object, doesn't matter): data() { return { list: [] } }
Use a v-for-loop to go through list and for each entry, render a component<Test :key="i"></Test>
Add any text/element/etc. inside the element: <Test:key="i">any string</Test>
Push a new entry to the list: this.list.push(....)
What is expected?
A new component is created and added to the list, other components inside the list remain "untouched".
What is actually happening?
A new component is created and added to the list and each already-existing instance of <Test> rendered in the list has their updated hook called.
Removing the text will stop updated-hooks from being called. Passing the same text as a prop and rendering it inside the component will not call updated-hooks.
Adding a <slot> to the template of the child component has no impact on updated-hook calls.
I'm not sure whether this is another version of #6351 or not. That issue is about updating slot content, whereas the issue here is about rendering multiple components via v-for while slot content remains the same.
The text was updated successfully, but these errors were encountered:
As you noticed it is the same as #6351. When adding new entries to the array, the slot renders again and needs to be passed to Test and render it again in case it changed
Version
2.6.11
Reproduction link
https://codesandbox.io/s/component-update-test-66fjt?expanddevtools=1&module=%2FApp.vue
Steps to reproduce
Either check out the reproduction link above, OR follow these steps:
data() { return { list: [] } }
v-for
-loop to go throughlist
and for each entry, render a component<Test :key="i"></Test>
<Test:key="i">any string</Test>
this.list.push(....)
What is expected?
A new component is created and added to the list, other components inside the list remain "untouched".
What is actually happening?
A new component is created and added to the list and each already-existing instance of
<Test>
rendered in the list has theirupdated
hook called.Removing the text will stop
updated
-hooks from being called. Passing the same text as a prop and rendering it inside the component will not callupdated
-hooks.Adding a
<slot>
to the template of the child component has no impact onupdated
-hook calls.I'm not sure whether this is another version of #6351 or not. That issue is about updating slot content, whereas the issue here is about rendering multiple components via
v-for
while slot content remains the same.The text was updated successfully, but these errors were encountered: