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
|
// add the new tag to the new tags value
|
||||||
const newTagIds = tags
|
onSetTags(
|
||||||
.map((t) => t.id)
|
tags.concat([
|
||||||
.concat([result.data.tagCreate.id]);
|
{
|
||||||
setFieldValue(newTagIds);
|
id: result.data.tagCreate.id,
|
||||||
|
name: toCreate.name ?? "",
|
||||||
|
aliases: [],
|
||||||
|
},
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
// remove the tag from the list
|
// remove the tag from the list
|
||||||
const newTagsClone = newTags!.concat();
|
const newTagsClone = newTags!.concat();
|
||||||
@@ -73,10 +78,17 @@ export function useTagsEdit(
|
|||||||
function updateTagsStateFromScraper(
|
function updateTagsStateFromScraper(
|
||||||
scrapedTags?: Pick<GQL.ScrapedTag, "name" | "stored_id">[]
|
scrapedTags?: Pick<GQL.ScrapedTag, "name" | "stored_id">[]
|
||||||
) {
|
) {
|
||||||
if (scrapedTags) {
|
if (!scrapedTags) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// map tags to their ids and filter out those not found
|
// 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(
|
onSetTags(
|
||||||
scrapedTags.map((p) => {
|
idTags.map((p) => {
|
||||||
return {
|
return {
|
||||||
id: p.stored_id!,
|
id: p.stored_id!,
|
||||||
name: p.name ?? "",
|
name: p.name ?? "",
|
||||||
@@ -85,8 +97,7 @@ export function useTagsEdit(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
setNewTags(scrapedTags.filter((t) => !t.stored_id));
|
setNewTags(newNewTags);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderNewTags() {
|
function renderNewTags() {
|
||||||
|
|||||||
Reference in New Issue
Block a user