Fix new values not removed correctly when added (#1890)

* Fix new values not removed correctly when added
This commit is contained in:
WithoutPants 2021-10-27 09:33:08 +11:00 committed by GitHub
parent a822455a66
commit e9c7b0aed3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 13 deletions

View file

@ -15,6 +15,7 @@
* Optimised scanning process. ([#1816](https://github.com/stashapp/stash/pull/1816))
### 🐛 Bug fixes
* Fix creating missing entities removing the incorrect entry from the missing list in the scrape dialog. ([#1890](https://github.com/stashapp/stash/pull/1890))
* Allow creating missing Studio during movie scrape. ([#1899](https://github.com/stashapp/stash/pull/1899))
* Fix image files in folder galleries not being deleting when delete file option is checked. ([#1872](https://github.com/stashapp/stash/pull/1872))
* Fix marker generation task reading video files unnecessarily. ([#1871](https://github.com/stashapp/stash/pull/1871))

View file

@ -60,7 +60,9 @@ function renderScrapedStudioRow(
}
onChange={onChange}
newValues={newStudio ? [newStudio] : undefined}
onCreateNew={onCreateNew}
onCreateNew={() => {
if (onCreateNew && newStudio) onCreateNew(newStudio);
}}
/>
);
}
@ -112,7 +114,9 @@ function renderScrapedPerformersRow(
}
onChange={onChange}
newValues={performersCopy}
onCreateNew={onCreateNew}
onCreateNew={(i) => {
if (onCreateNew) onCreateNew(newPerformers[i]);
}}
/>
);
}
@ -159,7 +163,9 @@ function renderScrapedTagsRow(
}
newValues={newTags}
onChange={onChange}
onCreateNew={onCreateNew}
onCreateNew={(i) => {
if (onCreateNew) onCreateNew(newTags[i]);
}}
/>
);
}

View file

@ -54,7 +54,11 @@ function renderScrapedStudioRow(
}
onChange={onChange}
newValues={newStudio ? [newStudio] : undefined}
onCreateNew={onCreateNew}
onCreateNew={() => {
if (onCreateNew && newStudio) {
onCreateNew(newStudio);
}
}}
/>
);
}

View file

@ -112,7 +112,9 @@ function renderScrapedTagsRow(
}
newValues={newTags}
onChange={onChange}
onCreateNew={onCreateNew}
onCreateNew={(i) => {
if (onCreateNew) onCreateNew(newTags[i]);
}}
/>
);
}

View file

@ -63,7 +63,9 @@ function renderScrapedStudioRow(
}
onChange={onChange}
newValues={newStudio ? [newStudio] : undefined}
onCreateNew={onCreateNew}
onCreateNew={() => {
if (onCreateNew && newStudio) onCreateNew(newStudio);
}}
/>
);
}
@ -115,7 +117,9 @@ function renderScrapedPerformersRow(
}
onChange={onChange}
newValues={performersCopy}
onCreateNew={onCreateNew}
onCreateNew={(i) => {
if (onCreateNew) onCreateNew(newPerformers[i]);
}}
/>
);
}
@ -167,7 +171,9 @@ function renderScrapedMoviesRow(
}
onChange={onChange}
newValues={moviesCopy}
onCreateNew={onCreateNew}
onCreateNew={(i) => {
if (onCreateNew) onCreateNew(newMovies[i]);
}}
/>
);
}
@ -214,7 +220,9 @@ function renderScrapedTagsRow(
}
newValues={newTags}
onChange={onChange}
onCreateNew={onCreateNew}
onCreateNew={(i) => {
if (onCreateNew) onCreateNew(newTags[i]);
}}
/>
);
}

View file

@ -50,7 +50,7 @@ export class ScrapeResult<T> {
}
interface IHasName {
name: string;
name: string | undefined;
}
interface IScrapedFieldProps<T> {
@ -64,7 +64,7 @@ interface IScrapedRowProps<T, V extends IHasName>
renderNewField: (result: ScrapeResult<T>) => JSX.Element | undefined;
onChange: (value: ScrapeResult<T>) => void;
newValues?: V[];
onCreateNew?: (newValue: V) => void;
onCreateNew?: (index: number) => void;
}
function renderButtonIcon(selected: boolean) {
@ -102,12 +102,12 @@ export const ScrapeDialogRow = <T, V extends IHasName>(
const ret = (
<>
{props.newValues!.map((t) => (
{props.newValues!.map((t, i) => (
<Badge
className="tag-item"
variant="secondary"
key={t.name}
onClick={() => props.onCreateNew!(t)}
onClick={() => props.onCreateNew!(i)}
>
{t.name}
<Button className="minimal ml-2">