Skip to content
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

Duplicates during sorts #60

Open
Brand3000 opened this issue Nov 10, 2023 · 2 comments
Open

Duplicates during sorts #60

Brand3000 opened this issue Nov 10, 2023 · 2 comments

Comments

@Brand3000
Copy link

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.

@anish2690
Copy link
Owner

@Brand3000 can you please provide reproduction repo ?

@anish2690 anish2690 added awaiting-feedback Needs more input before further actions can be taken need repro and removed awaiting-feedback Needs more input before further actions can be taken labels Dec 4, 2023
@Brand3000
Copy link
Author

Brand3000 commented Dec 5, 2023

@Brand3000 can you please provide reproduction repo ?

Look into this thread please outl1ne/nova-sortable#192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants