Browse Source

remove unneeded dispatch clear

master
jeffvli 3 years ago
parent
commit
36c96525ae
  1. 5
      src/components/card/Card.tsx
  2. 3
      src/components/playlist/PlaylistView.tsx
  3. 3
      src/components/starred/StarredView.tsx

5
src/components/card/Card.tsx

@ -3,7 +3,7 @@ import { Icon } from 'rsuite';
import { useHistory } from 'react-router-dom';
import { getAlbum, getPlaylist } from '../../api/api';
import { useAppDispatch } from '../../redux/hooks';
import { clearPlayQueue, setPlayQueue } from '../../redux/playQueueSlice';
import { setPlayQueue } from '../../redux/playQueueSlice';
import {
StyledPanel,
InfoPanel,
@ -41,19 +41,16 @@ const Card = ({
const handlePlayClick = async () => {
if (playClick.type === 'playlist') {
const res = await getPlaylist(playClick.id);
dispatch(clearPlayQueue());
dispatch(setPlayQueue(res.entry));
}
if (playClick.type === 'album') {
const res = await getAlbum(playClick.id);
dispatch(clearPlayQueue());
dispatch(setPlayQueue(res.song));
}
if (playClick.type === 'artist') {
const res = await getAlbum(playClick.id);
dispatch(clearPlayQueue());
dispatch(setPlayQueue(res.song));
}
};

3
src/components/playlist/PlaylistView.tsx

@ -3,7 +3,7 @@ import { useQuery } from 'react-query';
import { useParams } from 'react-router-dom';
import { getPlaylist } from '../../api/api';
import { useAppDispatch } from '../../redux/hooks';
import { setPlayQueue, clearPlayQueue } from '../../redux/playQueueSlice';
import { setPlayQueue } from '../../redux/playQueueSlice';
import {
toggleSelected,
setRangeSelected,
@ -92,7 +92,6 @@ const PlaylistView = () => {
timeout = null;
const newPlayQueue = data.entry.slice([e.index], data.entry.length);
dispatch(clearPlayQueue());
dispatch(clearSelected());
dispatch(setPlayQueue(newPlayQueue));
};

3
src/components/starred/StarredView.tsx

@ -4,7 +4,7 @@ import { useQuery } from 'react-query';
import { Nav } from 'rsuite';
import settings from 'electron-settings';
import { useAppDispatch } from '../../redux/hooks';
import { clearPlayQueue, setPlayQueue } from '../../redux/playQueueSlice';
import { setPlayQueue } from '../../redux/playQueueSlice';
import {
clearSelected,
setSelected,
@ -176,7 +176,6 @@ const StarredView = () => {
window.clearTimeout(timeout);
timeout = null;
const newPlayQueue = data.song.slice([e.index], data.song.length);
dispatch(clearPlayQueue());
dispatch(clearSelected());
dispatch(setPlayQueue(newPlayQueue));
};

Loading…
Cancel
Save