mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-24 14:37:07 -04:00
Fixed: Task with removed movie causing error
(cherry picked from commit fc6494c569324c839debdb1d08dde23b8f1b8d76) Closes #9866
This commit is contained in:
parent
28689006fb
commit
a75619c8ef
1 changed files with 10 additions and 1 deletions
|
@ -1,12 +1,21 @@
|
|||
import { createSelector } from 'reselect';
|
||||
import AppState from 'App/State/AppState';
|
||||
import Movie from 'Movie/Movie';
|
||||
|
||||
function createMultiMoviesSelector(movieIds: number[]) {
|
||||
return createSelector(
|
||||
(state: AppState) => state.movies.itemMap,
|
||||
(state: AppState) => state.movies.items,
|
||||
(itemMap, allMovies) => {
|
||||
return movieIds.map((movieId) => allMovies[itemMap[movieId]]);
|
||||
return movieIds.reduce((acc: Movie[], movieId) => {
|
||||
const movie = allMovies[itemMap[movieId]];
|
||||
|
||||
if (movie) {
|
||||
acc.push(movie);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue