diff --git a/ui/src/playlist/PlaylistSongs.js b/ui/src/playlist/PlaylistSongs.js index a88448546..73ce2c019 100644 --- a/ui/src/playlist/PlaylistSongs.js +++ b/ui/src/playlist/PlaylistSongs.js @@ -4,7 +4,6 @@ import { ListToolbar, TextField, NumberField, - useRefresh, useDataProvider, useNotify, useVersion, @@ -85,12 +84,11 @@ const ReorderableList = ({ readOnly, children, ...rest }) => { const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => { const listContext = useListContext() - const { data, ids, onUnselectItems } = listContext + const { data, ids, selectedIds, onUnselectItems, refetch } = listContext const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md')) const classes = useStyles({ isDesktop }) const dispatch = useDispatch() const dataProvider = useDataProvider() - const refresh = useRefresh() const notify = useNotify() const version = useVersion() useResourceRefresh('song', 'playlist') @@ -98,10 +96,10 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => { const onAddToPlaylist = useCallback( (pls) => { if (pls.id === playlistId) { - refresh() + refetch() } }, - [playlistId, refresh] + [playlistId, refetch] ) const reorder = useCallback( @@ -113,13 +111,13 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => { filter: { playlist_id: playlistId }, }) .then(() => { - refresh() + refetch() }) .catch(() => { notify('ra.page.error', 'warning') }) }, - [dataProvider, notify, refresh] + [dataProvider, notify, refetch] ) const handleDragEnd = useCallback( @@ -169,16 +167,15 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => { classes={{ toolbar: classes.toolbar }} filters={props.filters} actions={actions} - {...listContext} />
0, + [classes.bulkActionsDisplayed]: selectedIds.length > 0, })} key={version} > - +