From e32dd0aaa588877d14c97c5429c415714acd40ad Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 9 Jul 2025 03:48:46 +0000 Subject: [PATCH] Fix frontend duplicate tag creation in Label Selector (#861) * Initial plan * Fix frontend duplicate tag creation issue Co-authored-by: tankerkiller125 <3457368+tankerkiller125@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tankerkiller125 <3457368+tankerkiller125@users.noreply.github.com> --- frontend/components/Label/Selector.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/components/Label/Selector.vue b/frontend/components/Label/Selector.vue index 849bbc11..72b3fb29 100644 --- a/frontend/components/Label/Selector.vue +++ b/frontend/components/Label/Selector.vue @@ -130,8 +130,14 @@ })) .filter(i => !modelValue.value.includes(i.value)); + // Only show "Create" option if search term is not empty and no exact match exists if (searchTerm.value.trim() !== "") { - filtered.push({ value: "create-item", label: `${t("global.create")} ${searchTerm.value}` }); + const trimmedSearchTerm = searchTerm.value.trim(); + const hasExactMatch = props.labels.some(label => label.name.toLowerCase() === trimmedSearchTerm.toLowerCase()); + + if (!hasExactMatch) { + filtered.push({ value: "create-item", label: `${t("global.create")} ${searchTerm.value}` }); + } } return filtered;