Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Fix frontend duplicate tag creation in Label Selector (#861)

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