Browse Source

clean up sort

master
jeffvli 3 years ago
parent
commit
a4dbb55af5
  1. 18
      src/components/viewtypes/ListViewTable.tsx

18
src/components/viewtypes/ListViewTable.tsx

@ -27,10 +27,8 @@ import { setRating, star, unstar } from '../../api/api';
import { useAppDispatch } from '../../redux/hooks'; import { useAppDispatch } from '../../redux/hooks';
import { import {
fixPlayer2Index, fixPlayer2Index,
setPlayQueue,
setStar, setStar,
sortPlayQueue, sortPlayQueue,
updatePlayerIndices,
} from '../../redux/playQueueSlice'; } from '../../redux/playQueueSlice';
import { StyledIconToggle, StyledRate } from '../shared/styled'; import { StyledIconToggle, StyledRate } from '../shared/styled';
import { addModalPage } from '../../redux/miscSlice'; import { addModalPage } from '../../redux/miscSlice';
@ -139,14 +137,12 @@ const ListViewTable = ({
? 'title' ? 'title'
: actualSortColumn.dataKey; : actualSortColumn.dataKey;
// console.log(sortColumnDataKey);
dispatch( dispatch(
sortPlayQueue({ sortPlayQueue({
columnDataKey: sortColumnDataKey, columnDataKey: sortColumnDataKey,
sortType, sortType,
}) })
); );
dispatch(fixPlayer2Index());
} else { } else {
// Clear the sortedEntry[] // Clear the sortedEntry[]
dispatch( dispatch(
@ -155,10 +151,20 @@ const ListViewTable = ({
sortType, sortType,
}) })
); );
dispatch(fixPlayer2Index());
} }
} }
}, [columns, dispatch, nowPlaying, sortColumn, sortType, sortedData]); if (playQueue.currentPlayer === 1) {
dispatch(fixPlayer2Index());
}
}, [
columns,
dispatch,
nowPlaying,
playQueue.currentPlayer,
sortColumn,
sortType,
sortedData,
]);
return ( return (
<> <>

Loading…
Cancel
Save