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>
This commit is contained in:
Copilot
2025-07-09 03:48:46 +00:00
committed by GitHub
parent ee5c43dc29
commit e32dd0aaa5

View File

@@ -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;