diff --git a/ui/src/actions/player.js b/ui/src/actions/player.js index a9e2577f4..acef2e9b2 100644 --- a/ui/src/actions/player.js +++ b/ui/src/actions/player.js @@ -14,10 +14,17 @@ export const setTrack = (data) => ({ }) export const filterSongs = (data, ids) => { - if (!ids) { - return data - } - return ids.reduce((acc, id) => ({ ...acc, [id]: data[id] }), {}) + const filteredData = Object.fromEntries( + Object.entries(data).filter(([_, song]) => !song.missing), + ) + return !ids + ? filteredData + : ids.reduce((acc, id) => { + if (filteredData[id]) { + return { ...acc, [id]: filteredData[id] } + } + return acc + }, {}) } export const addTracks = (data, ids) => { diff --git a/ui/src/album/AlbumActions.jsx b/ui/src/album/AlbumActions.jsx index 65d6fe64c..96cfab09a 100644 --- a/ui/src/album/AlbumActions.jsx +++ b/ui/src/album/AlbumActions.jsx @@ -73,8 +73,9 @@ const AlbumActions = ({ }, [dispatch, data, ids]) const handleAddToPlaylist = React.useCallback(() => { - dispatch(openAddToPlaylist({ selectedIds: ids })) - }, [dispatch, ids]) + const selectedIds = ids.filter((id) => !data[id].missing) + dispatch(openAddToPlaylist({ selectedIds })) + }, [dispatch, data, ids]) const handleShare = React.useCallback(() => { dispatch(openShareMenu([record.id], 'album', record.name)) diff --git a/ui/src/common/ContextMenus.jsx b/ui/src/common/ContextMenus.jsx index 623b01a24..855825496 100644 --- a/ui/src/common/ContextMenus.jsx +++ b/ui/src/common/ContextMenus.jsx @@ -233,6 +233,7 @@ export const AlbumContextMenu = (props) => album_id: props.record.id, release_date: props.releaseDate, disc_number: props.discNumber, + missing: false, }, }} /> @@ -262,7 +263,7 @@ export const ArtistContextMenu = (props) => field: 'album', order: 'ASC', }, - filter: { album_artist_id: props.record.id }, + filter: { album_artist_id: props.record.id, missing: false }, }} /> ) : null diff --git a/ui/src/common/ShuffleAllButton.jsx b/ui/src/common/ShuffleAllButton.jsx index bc455b615..1631e2cf5 100644 --- a/ui/src/common/ShuffleAllButton.jsx +++ b/ui/src/common/ShuffleAllButton.jsx @@ -10,6 +10,7 @@ export const ShuffleAllButton = ({ filters }) => { const dataProvider = useDataProvider() const dispatch = useDispatch() const notify = useNotify() + filters = { ...filters, missing: false } const handleOnClick = () => { dataProvider