mirror of
https://github.com/Radarr/Radarr
synced 2025-12-25 09:42:24 +01:00
17 lines
580 B
TypeScript
17 lines
580 B
TypeScript
import { createSelector } from 'reselect';
|
|
import AppState from 'App/State/AppState';
|
|
|
|
function createCollectionSelector() {
|
|
return createSelector(
|
|
(_: AppState, { collectionId }: { collectionId: number }) => collectionId,
|
|
(state: AppState) => state.movieCollections.itemMap,
|
|
(state: AppState) => state.movieCollections.items,
|
|
(collectionId, itemMap, allCollections) => {
|
|
return allCollections && itemMap && collectionId in itemMap
|
|
? allCollections[itemMap[collectionId]]
|
|
: undefined;
|
|
}
|
|
);
|
|
}
|
|
|
|
export default createCollectionSelector;
|