Skip to content

Commit

Permalink
Fix display of matched scraped tags
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants committed Dec 2, 2024
1 parent ef2231f commit c041744
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ui/v2.5/src/hooks/tagsEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,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 ?? "",
Expand All @@ -85,8 +92,7 @@ export function useTagsEdit(
})
);

setNewTags(scrapedTags.filter((t) => !t.stored_id));
}
setNewTags(newNewTags);
}

function renderNewTags() {
Expand Down

0 comments on commit c041744

Please sign in to comment.