Fixed: Task with removed series causing error
This commit is contained in:
parent
c403b2cdd5
commit
fc6494c569
|
@ -1,12 +1,21 @@
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import AppState from 'App/State/AppState';
|
import AppState from 'App/State/AppState';
|
||||||
|
import Series from 'Series/Series';
|
||||||
|
|
||||||
function createMultiSeriesSelector(seriesIds: number[]) {
|
function createMultiSeriesSelector(seriesIds: number[]) {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state: AppState) => state.series.itemMap,
|
(state: AppState) => state.series.itemMap,
|
||||||
(state: AppState) => state.series.items,
|
(state: AppState) => state.series.items,
|
||||||
(itemMap, allSeries) => {
|
(itemMap, allSeries) => {
|
||||||
return seriesIds.map((seriesId) => allSeries[itemMap[seriesId]]);
|
return seriesIds.reduce((acc: Series[], seriesId) => {
|
||||||
|
const series = allSeries[itemMap[seriesId]];
|
||||||
|
|
||||||
|
if (series) {
|
||||||
|
acc.push(series);
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue