Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: prevent duplicate packing category names from merging — auto-append number — closes #100

Mauricee05e021f41ba
diff --git a/client/src/components/Packing/PackingListPanel.tsx b/client/src/components/Packing/PackingListPanel.tsx
index 0fd5c2ebd..7d670dbb4 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')) }