mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Fix scraped tags issues (#5522)
* Fix display of matched scraped tags * Fix create new scraped tag not updating field correctly
This commit is contained in:
@@ -44,10 +44,15 @@ export function useTagsEdit(
|
||||
}
|
||||
|
||||
// add the new tag to the new tags value
|
||||
const newTagIds = tags
|
||||
.map((t) => t.id)
|
||||
.concat([result.data.tagCreate.id]);
|
||||
setFieldValue(newTagIds);
|
||||
onSetTags(
|
||||
tags.concat([
|
||||
{
|
||||
id: result.data.tagCreate.id,
|
||||
name: toCreate.name ?? "",
|
||||
aliases: [],
|
||||
},
|
||||
])
|
||||
);
|
||||
|
||||
// remove the tag from the list
|
||||
const newTagsClone = newTags!.concat();
|
||||
@@ -73,10 +78,17 @@ export function useTagsEdit(
|
||||
function updateTagsStateFromScraper(
|
||||
scrapedTags?: Pick<GQL.ScrapedTag, "name" | "stored_id">[]
|
||||
) {
|
||||
if (scrapedTags) {
|
||||
if (!scrapedTags) {
|
||||
return;
|
||||
}
|
||||
|
||||
// map tags to their ids and filter out those not found
|
||||
const idTags = scrapedTags.filter(
|
||||
(t) => t.stored_id !== undefined && t.stored_id !== null
|
||||
);
|
||||
const newNewTags = scrapedTags.filter((t) => !t.stored_id);
|
||||
onSetTags(
|
||||
scrapedTags.map((p) => {
|
||||
idTags.map((p) => {
|
||||
return {
|
||||
id: p.stored_id!,
|
||||
name: p.name ?? "",
|
||||
@@ -85,8 +97,7 @@ export function useTagsEdit(
|
||||
})
|
||||
);
|
||||
|
||||
setNewTags(scrapedTags.filter((t) => !t.stored_id));
|
||||
}
|
||||
setNewTags(newNewTags);
|
||||
}
|
||||
|
||||
function renderNewTags() {
|
||||
|
||||
Reference in New Issue
Block a user