mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-01 19:47:37 +03:00
fix(ui): skip missing files in bulk operations (#3807)
* fix(ui): skip missing files when adding to playqueue Signed-off-by: Deluan <deluan@navidrome.org> * fix(ui): skip missing files when adding to playlists * fix(ui): skip missing files when shuffling songs Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
2a15a217de
commit
70f536e04d
4 changed files with 17 additions and 7 deletions
|
@ -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) => {
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -10,6 +10,7 @@ export const ShuffleAllButton = ({ filters }) => {
|
|||
const dataProvider = useDataProvider()
|
||||
const dispatch = useDispatch()
|
||||
const notify = useNotify()
|
||||
filters = { ...filters, missing: false }
|
||||
|
||||
const handleOnClick = () => {
|
||||
dataProvider
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue