vue-draggable-next
vue-draggable-next copied to clipboard
Duplicates during sorts
Hello! I use Laravel Nova with the outl1ne/nova-sortable package for having the ability to sort items. When I try to drag an item down, it duplicates. Actually, this problem was noticed by several developers. Look this issue please.
I dug into the core and realised that there's an issue especially with vue-draggable-next.
If the keys like so:
service-resource-items-0
service-resource-items-1
service-resource-items-2
...
everything works fine
However, if the keys like so:
service-resource-items-0-1
service-resource-items-1-2
service-resource-items-2-3
...
the issue happens.
A piece of the source code:
<draggable
tag="tbody"
v-model="fakeResources"
draggable="tr"
@update="updateOrder"
>
<ResourceTableRow
v-for="(resource, index) in fakeResources"
:key="`${resourceName}-items-${index}-${resource.id.value}`"
/>
</draggable>
If I delete the "-${resource.id.value}" part from the :key attribute, sorting works fine.
@Brand3000 can you please provide reproduction repo ?
@Brand3000 can you please provide reproduction repo ?
Look into this thread please https://github.com/outl1ne/nova-sortable/issues/192