diff --git a/frontend/src/InteractiveImport/Season/SelectSeasonModalContent.tsx b/frontend/src/InteractiveImport/Season/SelectSeasonModalContent.tsx
index 41ba30794..b11da4320 100644
--- a/frontend/src/InteractiveImport/Season/SelectSeasonModalContent.tsx
+++ b/frontend/src/InteractiveImport/Season/SelectSeasonModalContent.tsx
@@ -5,7 +5,7 @@ import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
-import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
+import { createSeriesSelectorForHook } from 'Store/Selectors/createSeriesSelector';
import SelectSeasonRow from './SelectSeasonRow';
interface SelectSeasonModalContentProps {
@@ -17,7 +17,7 @@ interface SelectSeasonModalContentProps {
function SelectSeasonModalContent(props: SelectSeasonModalContentProps) {
const { seriesId, modalTitle, onSeasonSelect, onModalClose } = props;
- const series = useSelector(createSeriesSelector(seriesId));
+ const series = useSelector(createSeriesSelectorForHook(seriesId));
const seasons = useMemo(() => {
return series.seasons.slice(0).reverse();
}, [series]);
diff --git a/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx b/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx
index 25038e2bb..805d417bb 100644
--- a/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx
+++ b/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx
@@ -23,7 +23,7 @@ import Series from 'Series/Series';
import { grabRelease } from 'Store/Actions/releaseActions';
import { fetchDownloadClients } from 'Store/Actions/settingsActions';
import createEnabledDownloadClientsSelector from 'Store/Selectors/createEnabledDownloadClientsSelector';
-import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
+import { createSeriesSelectorForHook } from 'Store/Selectors/createSeriesSelector';
import translate from 'Utilities/String/translate';
import SelectDownloadClientModal from './DownloadClient/SelectDownloadClientModal';
import OverrideMatchData from './OverrideMatchData';
@@ -77,7 +77,9 @@ function OverrideMatchModalContent(props: OverrideMatchModalContentProps) {
);
const dispatch = useDispatch();
- const series: Series = useSelector(createSeriesSelector(seriesId));
+ const series: Series | undefined = useSelector(
+ createSeriesSelectorForHook(seriesId)
+ );
const { items: downloadClients } = useSelector(
createEnabledDownloadClientsSelector(protocol)
);
@@ -88,7 +90,7 @@ function OverrideMatchModalContent(props: OverrideMatchModalContentProps) {
{episode.episodeNumber}
- {series.seriesType === 'anime' &&
+ {series?.seriesType === 'anime' &&
episode.absoluteEpisodeNumber != null
? ` (${episode.absoluteEpisodeNumber})`
: ''}
@@ -351,7 +353,7 @@ function OverrideMatchModalContent(props: OverrideMatchModalContentProps) {
isOpen={selectModalOpen === 'episode'}
selectedIds={[guid]}
seriesId={seriesId}
- isAnime={series.seriesType === 'anime'}
+ isAnime={series?.seriesType === 'anime'}
seasonNumber={seasonNumber}
selectedDetails={title}
modalTitle={modalTitle}
diff --git a/frontend/src/Series/Index/createSeriesIndexItemSelector.ts b/frontend/src/Series/Index/createSeriesIndexItemSelector.ts
index ec2d95f2b..790067ccd 100644
--- a/frontend/src/Series/Index/createSeriesIndexItemSelector.ts
+++ b/frontend/src/Series/Index/createSeriesIndexItemSelector.ts
@@ -3,11 +3,11 @@ import { createSelector } from 'reselect';
import { REFRESH_SERIES, SERIES_SEARCH } from 'Commands/commandNames';
import createExecutingCommandsSelector from 'Store/Selectors/createExecutingCommandsSelector';
import createSeriesQualityProfileSelector from 'Store/Selectors/createSeriesQualityProfileSelector';
-import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
+import { createSeriesSelectorForHook } from 'Store/Selectors/createSeriesSelector';
function createSeriesIndexItemSelector(seriesId: number) {
return createSelector(
- createSeriesSelector(seriesId),
+ createSeriesSelectorForHook(seriesId),
createSeriesQualityProfileSelector(seriesId),
createExecutingCommandsSelector(),
(series, qualityProfile, executingCommands) => {
diff --git a/frontend/src/Store/Selectors/createSeriesSelector.js b/frontend/src/Store/Selectors/createSeriesSelector.js
index 34881b20e..c9f0f6e43 100644
--- a/frontend/src/Store/Selectors/createSeriesSelector.js
+++ b/frontend/src/Store/Selectors/createSeriesSelector.js
@@ -1,22 +1,22 @@
import { createSelector } from 'reselect';
-function createSeriesSelector(id) {
- if (id == null) {
- return createSelector(
- (state, { seriesId }) => seriesId,
- (state) => state.series.itemMap,
- (state) => state.series.items,
- (seriesId, itemMap, allSeries) => {
- return allSeries[itemMap[seriesId]];
- }
- );
- }
-
+export function createSeriesSelectorForHook(seriesId) {
return createSelector(
(state) => state.series.itemMap,
(state) => state.series.items,
(itemMap, allSeries) => {
- return allSeries[itemMap[id]];
+ return seriesId ? allSeries[itemMap[seriesId]]: undefined;
+ }
+ );
+}
+
+function createSeriesSelector() {
+ return createSelector(
+ (state, { seriesId }) => seriesId,
+ (state) => state.series.itemMap,
+ (state) => state.series.items,
+ (seriesId, itemMap, allSeries) => {
+ return allSeries[itemMap[seriesId]];
}
);
}
diff --git a/frontend/src/typings/DownloadClient.ts b/frontend/src/typings/DownloadClient.ts
new file mode 100644
index 000000000..2c032c22a
--- /dev/null
+++ b/frontend/src/typings/DownloadClient.ts
@@ -0,0 +1,28 @@
+import ModelBase from 'App/ModelBase';
+
+export interface Field {
+ order: number;
+ name: string;
+ label: string;
+ value: boolean | number | string;
+ type: string;
+ advanced: boolean;
+ privacy: string;
+}
+
+interface DownloadClient extends ModelBase {
+ enable: boolean;
+ protocol: string;
+ priority: number;
+ removeCompletedDownloads: boolean;
+ removeFailedDownloads: boolean;
+ name: string;
+ fields: Field[];
+ implementationName: string;
+ implementation: string;
+ configContract: string;
+ infoLink: string;
+ tags: number[];
+}
+
+export default DownloadClient;