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. 12
      src/components/viewtypes/ListViewTable.tsx

12
src/components/viewtypes/ListViewTable.tsx

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

Loading…
Cancel
Save