Prevent studio parent id and scene rating from being unset when tagged (#927)

This commit is contained in:
InfiniteTF
2020-11-06 03:14:17 +01:00
committed by GitHub
parent 5f482b7b8a
commit 8a04e5df62
3 changed files with 11 additions and 3 deletions

View File

@@ -6,4 +6,7 @@ fragment SlimStudioData on Studio {
endpoint endpoint
stash_id stash_id
} }
parent_studio {
id
}
} }

View File

@@ -143,7 +143,7 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
studioID = studioCreateResult.data.studioCreate.id; studioID = studioCreateResult.data.studioCreate.id;
} else if (studio.type === "update") { } else if (studio.type === "update") {
setSaveState("Saving studio stashID"); setSaveState("Saving studio stashID");
const res = await updateStudioStashID(studio.data.id, [ const res = await updateStudioStashID(studio.data, [
...studio.data.stash_ids, ...studio.data.stash_ids,
{ stash_id: scene.studio.stash_id, endpoint }, { stash_id: scene.studio.stash_id, endpoint },
]); ]);
@@ -284,6 +284,7 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
cover_image: imgData, cover_image: imgData,
url: scene.url, url: scene.url,
tag_ids: updatedTags, tag_ids: updatedTags,
rating: stashScene.rating,
stash_ids: [ stash_ids: [
...(stashScene?.stash_ids ?? []), ...(stashScene?.stash_ids ?? []),
{ {

View File

@@ -111,10 +111,14 @@ export const useUpdateStudioStashID = () => {
onError: (errors) => errors, onError: (errors) => errors,
}); });
const handleUpdate = (studioID: string, stashIDs: GQL.StashIdInput[]) => const handleUpdate = (
studio: GQL.SlimStudioDataFragment,
stashIDs: GQL.StashIdInput[]
) =>
updateStudio({ updateStudio({
variables: { variables: {
id: studioID, id: studio.id,
parent_id: studio.parent_studio?.id,
stash_ids: stashIDs.map((s) => ({ stash_ids: stashIDs.map((s) => ({
stash_id: s.stash_id, stash_id: s.stash_id,
endpoint: s.endpoint, endpoint: s.endpoint,