I've got an array with component data that I'm attempting to render using v-for
<div :style="style" class="editor-component" v-for="(component, index) in components">
<Component
:is="component.name"
v-bind="component.options"
:key="createKey(component, index)"
:style="component.style ? component.style : {}"
/>
</div>
Here's the issue:
When a component option has an array with just 1 element, like
tabs: [{tab}]
everything works fine. However, when there are 2 or more elements in the tabs array, like this
tabs: [{tab},{tab}]
The component doesn't detect changes in the second tab.
So, I came up with a solution using dynamic keys
createKey(component, index) {
return JSON.stringify(component) + index
}
But this causes the component to re-render after each change and resets its state to default.
UPDATE: I encountered a similar problem on Reactive Nested V-For's using Vue/Vuex, but unfortunately it doesn't have a definitive answer :(