From 38b6b1312abdd6779f2ba47afb64577d3a5b8570 Mon Sep 17 00:00:00 2001 From: InfiniteStash <117855276+InfiniteStash@users.noreply.github.com> Date: Fri, 24 Jan 2025 14:02:23 +0100 Subject: [PATCH] Fix filtering of exact tag searches (#912) --- frontend/src/components/tagFilter/TagFilter.tsx | 17 ++++++++++------- frontend/src/components/tagSelect/TagSelect.tsx | 15 ++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/tagFilter/TagFilter.tsx b/frontend/src/components/tagFilter/TagFilter.tsx index 52e345f08..0d6c638c7 100644 --- a/frontend/src/components/tagFilter/TagFilter.tsx +++ b/frontend/src/components/tagFilter/TagFilter.tsx @@ -56,13 +56,16 @@ const TagFilter: FC = ({ const { exact, query } = data; - const exactResult = exact - ? { - label: exact.name, - value: exact, - sublabel: exact.description ?? "", - } - : undefined; + const exactResult = + exact && + (allowDeleted || !exact.deleted) && + !excludeTags.includes(exact.id) + ? { + label: exact.name, + value: exact, + sublabel: exact.description ?? "", + } + : undefined; const queryResult = query .filter( diff --git a/frontend/src/components/tagSelect/TagSelect.tsx b/frontend/src/components/tagSelect/TagSelect.tsx index 4f764fec4..2fe49fd7d 100644 --- a/frontend/src/components/tagSelect/TagSelect.tsx +++ b/frontend/src/components/tagSelect/TagSelect.tsx @@ -93,13 +93,14 @@ const TagSelect: FC = ({ const { exact, query } = data; - const exactResult = exact - ? { - label: exact.name, - value: exact, - sublabel: exact.description ?? "", - } - : undefined; + const exactResult = + exact && !excluded.includes(exact.id) && (allowDeleted || !exact.deleted) + ? { + label: exact.name, + value: exact, + sublabel: exact.description ?? "", + } + : undefined; const queryResult = query .filter(