tres icon indicating copy to clipboard operation
tres copied to clipboard

When using a v-for inside a component slot it doesn't remove the last item

Open franciscohermida opened this issue 8 months ago • 1 comments

Describe the bug

Creating elements using a v-for inside a component slot will not remove the last item

CompB:

<template>
  <slot></slot>
</template>

CompA:

<CompB>
    <!-- the last mesh will not be removed when all items of array items are removed -->
    <TresMesh v-for="item in items">
      ...
    </TresMesh>
</CompB >

Reproduction

https://stackblitz.com/edit/tresjs-minimal-reproduction-qyy6kmyp?file=src%2FApp.vue

Steps to reproduce

Press the add item button press the "Remove Item" until items total is 0 the last box should be removed

System Info


Used Package Manager

npm

Code of Conduct

franciscohermida avatar Apr 28 '25 07:04 franciscohermida

Have you tried adding the key attribute to v-for? For example, like this:

<ul>
  <li v-for="item in items" :key="item.id">...</li>
</ul>

daLeiStrive avatar Jul 11 '25 08:07 daLeiStrive