Browse Source

Remove window refetch on playlist

master
jeffvli 3 years ago
parent
commit
e8ad1f9803
  1. 8
      src/components/playlist/PlaylistView.tsx

8
src/components/playlist/PlaylistView.tsx

@ -72,9 +72,7 @@ const PlaylistView = ({ ...rest }) => {
const { isLoading, isError, data, error }: any = useQuery( const { isLoading, isError, data, error }: any = useQuery(
['playlist', playlistId], ['playlist', playlistId],
() => getPlaylist(playlistId), () => getPlaylist(playlistId),
{ { refetchOnWindowFocus: false }
refetchOnWindowFocus: multiSelect.selected.length < 1 || !isModified,
}
); );
const [editName, setEditName] = useState(''); const [editName, setEditName] = useState('');
const [editDescription, setEditDescription] = useState(''); const [editDescription, setEditDescription] = useState('');
@ -294,7 +292,7 @@ const PlaylistView = ({ ...rest }) => {
<SaveButton <SaveButton
size="lg" size="lg"
text={needsRecovery ? 'Recover playlist' : undefined} text={needsRecovery ? 'Recover playlist' : undefined}
color={needsRecovery ? 'red' : isModified ? 'green' : undefined} color={needsRecovery ? 'red' : undefined}
disabled={ disabled={
(!needsRecovery && !isModified) || (!needsRecovery && !isModified) ||
misc.isProcessingPlaylist.includes(data?.id) misc.isProcessingPlaylist.includes(data?.id)
@ -304,7 +302,7 @@ const PlaylistView = ({ ...rest }) => {
/> />
<UndoButton <UndoButton
size="lg" size="lg"
color={needsRecovery ? 'red' : isModified ? 'green' : undefined} color={needsRecovery ? 'red' : undefined}
disabled={ disabled={
needsRecovery || !isModified || misc.isProcessingPlaylist.includes(data?.id) needsRecovery || !isModified || misc.isProcessingPlaylist.includes(data?.id)
} }

Loading…
Cancel
Save