stimulus-sortable
stimulus-sortable copied to clipboard
Makes A Request When An Item Is Dropped In Its Original Location
With the current implementation there is no check in place to see if the new location and old location are the same, if so do nothing.
This avoids server requests if someone grabs and then drops an item without moving it to a new location.
Maybe we should use onUpdate
instead of onEnd
as default callback?
As a workaround you can override the controller with something like this I guess in the options:
{
onUpdate: this.end
}
I'll try that out, comparing newIndex and oldIndex might cause an issue if someone moves an item to a new parent, indexes could be the same but it is actually a move.
Yep, that is why I think using onUpdate
might be the right solution because Sortable will only trigger the callback is the position actually change 🤔 didn't try it yet though
Changed in https://github.com/stimulus-components/stimulus-sortable/releases/tag/v4.0.0
Thanks @MatthewKennedy