Fix incorrect performer removed after creation (#3251)

This commit is contained in:
WithoutPants
2022-12-08 19:08:29 +11:00
committed by GitHub
parent 782bed9df8
commit 2064ea27b0
2 changed files with 8 additions and 1 deletions

View File

@@ -470,7 +470,11 @@ export const SceneScrapeDialog: React.FC<ISceneScrapeDialogProps> = ({
// remove the performer from the list
const newPerformersClone = newPerformers.concat();
const pIndex = newPerformersClone.indexOf(toCreate);
const pIndex = newPerformersClone.findIndex(
(p) => p.name === toCreate.name
);
if (pIndex === -1) throw new Error("Could not find performer to remove");
newPerformersClone.splice(pIndex, 1);
setNewPerformers(newPerformersClone);
@@ -520,6 +524,7 @@ export const SceneScrapeDialog: React.FC<ISceneScrapeDialogProps> = ({
// remove the movie from the list
const newMoviesClone = newMovies.concat();
const pIndex = newMoviesClone.indexOf(toCreate);
if (pIndex === -1) throw new Error("Could not find movie to remove");
newMoviesClone.splice(pIndex, 1);
setNewMovies(newMoviesClone);
@@ -555,6 +560,7 @@ export const SceneScrapeDialog: React.FC<ISceneScrapeDialogProps> = ({
// remove the tag from the list
const newTagsClone = newTags.concat();
const pIndex = newTagsClone.indexOf(toCreate);
if (pIndex === -1) throw new Error("Could not find performer to remove");
newTagsClone.splice(pIndex, 1);
setNewTags(newTagsClone);