Browse Source

Add debounce function for drag multiselect

To handle larger lists, a short debounce will increase performance
master
jeffvli 3 years ago
parent
commit
1c9703d9e4
  1. 8
      src/components/viewtypes/ListViewTable.tsx

8
src/components/viewtypes/ListViewTable.tsx

@ -168,12 +168,16 @@ const ListViewTable = ({
// If mouse is still held down from the handleSelectMouseDown function, then
// mousing over a row will set the range selection from the initial mousedown location
// to the mouse-entered row
const handleSelectMouseEnter = (rowData: any) => {
if (multiSelect.isSelectDragging) {
const debouncedMouseEnterFn = _.debounce((rowData: any) => {
dispatch(setRangeSelected(rowData));
dispatch(
toggleRangeSelected(sortColumn && !nowPlaying ? sortedData : data)
);
}, 100);
const handleSelectMouseEnter = (rowData: any) => {
if (multiSelect.isSelectDragging) {
debouncedMouseEnterFn(rowData);
}
};

Loading…
Cancel
Save