mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-23 06:20:50 +00:00
Fixed: Task with removed artists causing error
(cherry picked from commit fc6494c569324c839debdb1d08dde23b8f1b8d76) Closes #4696
This commit is contained in:
parent
13ce040e4d
commit
28f2eb974d
1 changed files with 10 additions and 1 deletions
|
@ -1,12 +1,21 @@
|
|||
import { createSelector } from 'reselect';
|
||||
import AppState from 'App/State/AppState';
|
||||
import Artist from 'Artist/Artist';
|
||||
|
||||
function createMultiArtistsSelector(artistIds: number[]) {
|
||||
return createSelector(
|
||||
(state: AppState) => state.artist.itemMap,
|
||||
(state: AppState) => state.artist.items,
|
||||
(itemMap, allArtists) => {
|
||||
return artistIds.map((artistId) => allArtists[itemMap[artistId]]);
|
||||
return artistIds.reduce((acc: Artist[], artistId) => {
|
||||
const artist = allArtists[itemMap[artistId]];
|
||||
|
||||
if (artist) {
|
||||
acc.push(artist);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue