Fixed: Manual Import multiple episode selection

Closes #5543
This commit is contained in:
Mark McDowall 2023-04-10 22:04:58 -07:00
parent b2c43fb2a6
commit 48a82ad711
2 changed files with 15 additions and 10 deletions

View File

@ -58,7 +58,7 @@ function episodesSelector() {
}
export interface SelectedEpisode {
fileId: number;
id: number;
episodes: Episode[];
}
@ -163,7 +163,7 @@ function SelectEpisodeModalContent(props: SelectEpisodeModalContentProps) {
return a.seasonNumber - b.seasonNumber;
});
const mappedEpisodes = selectedIds.map((fileId, index): SelectedEpisode => {
const mappedEpisodes = selectedIds.map((id, index): SelectedEpisode => {
const startingIndex = index * episodesPerFile;
const episodes = sortedEpisodes.slice(
startingIndex,
@ -171,7 +171,7 @@ function SelectEpisodeModalContent(props: SelectEpisodeModalContentProps) {
);
return {
fileId: fileId as number,
id: id as number,
episodes,
};
});

View File

@ -51,6 +51,7 @@ import {
reprocessInteractiveImportItems,
setInteractiveImportMode,
setInteractiveImportSort,
updateInteractiveImportItem,
updateInteractiveImportItems,
} from 'Store/Actions/interactiveImportActions';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
@ -616,13 +617,17 @@ function InteractiveImportModalContent(
);
const onEpisodesSelect = useCallback(
(episodes: SelectedEpisode[]) => {
(selectedEpisodes: SelectedEpisode[]) => {
selectedEpisodes.forEach((selectedEpisode) => {
const { id, episodes } = selectedEpisode;
dispatch(
updateInteractiveImportItems({
ids: selectedIds,
updateInteractiveImportItem({
id,
episodes,
})
);
});
dispatch(reprocessInteractiveImportItems({ ids: selectedIds }));