Skip to content

Change options watch handler to update values via native Sortable method #24

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

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

hjbdev
Copy link
Contributor

@hjbdev hjbdev commented Aug 23, 2022

The group option is manipulated by Sortable to include checkPut and checkPull methods, when Sortable-vue3 detects options have changed, it overwrites the options property on Sortable directly.

This means you lose checkPut and checkPull (destructuring is only a shallow merge), causing errors when you try to drag between groups.

image

To resolve, I've changed the watch handler to use the option method on the Sortable object, looping through and updating the values one by one.

This seems to have resolved the issue.

I've also had to move the prop type out into a dedicated type to keep TS happy.

@vercel
Copy link

vercel bot commented Aug 23, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
sortablejs-vue3 ✅ Ready (Inspect) Visit Preview Aug 23, 2022 at 9:53AM (UTC)

@MaxLeiter MaxLeiter merged commit 5dddbf2 into MaxLeiter:main Aug 25, 2022
@MaxLeiter
Copy link
Owner

thank you! LGTM

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

Successfully merging this pull request may close these issues.

2 participants