Sortable
Sortable copied to clipboard
[bug] Significant lag when shift-selecting large data set range with MultiDrag
Describe the bug
When attempting to shift+select a large number of items (500+) to move to another list there is a significant lag (~1 second per 100 items).
To Reproduce I've created a rough test jsbin with 1000 items for testing: https://jsbin.com/weraxoroho/edit?html,js,output Steps to reproduce the behavior:
- Select the first item
- Scroll to the bottom of the first list and select the last item while holding SHIFT
- Wait about 10 seconds before they're all selected (will turn green)
Expected behavior
The expected behavior is an instant selection of all items with no lag.
Information
sortablejs = 1.15.0
Additional context The same lag is found in Chrome, Firefox, and Safari. Doing some digging into the codebase, I was able to track down the suspected culprit of the lag.
On Line 3514 is the for loop that handles each element within the Shift+select range Within that loop it calls dispatchEvent() and within that function is a call to _objectSpread2() on Line 948
https://github.com/SortableJS/Sortable/blob/babf6ab85fdfc5e13be1027827cecfbba2fb0d1e/Sortable.js#L948
Commenting out this line along with lines 950-952, it works blazing fast and selects everything as expected.
Can _objectSpread2() be better optimized? Or is there a work around for MultiDrag with large data sets?
+1, interested in developments for large scale data
+1