···254254 group.cards.push(card);
255255 groups.set(type, group);
256256 } else {
257257- // Has tags โ add to each tag group
258258- for (const tag of card.tags) {
257257+ // Has tags โ add to each unique tag group (dedupe to handle malformed data)
258258+ for (const tag of new Set(card.tags)) {
259259 const group = groups.get(tag) ?? { cards: [], forTag: true };
260260 group.forTag = true;
261261 group.cards.push(card);
+13-9
src/lib/deck-import.ts
···5959 const tagsPart = trimmed.slice(firstHashIndex);
6060 remaining = trimmed.slice(0, firstHashIndex).trim();
61616262- // Split by # and process each tag
6363- tags = tagsPart
6464- .split("#")
6565- .map((t) => t.trim())
6666- .filter((t) => t.length > 0)
6767- .map((t) => {
6868- // Remove optional ! prefix (Moxfield uses #! for "global" tags)
6969- return t.startsWith("!") ? t.slice(1).trim() : t;
7070- });
6262+ // Split by # and process each tag (dedupe to handle #foo #foo)
6363+ tags = Array.from(
6464+ new Set(
6565+ tagsPart
6666+ .split("#")
6767+ .map((t) => t.trim())
6868+ .filter((t) => t.length > 0)
6969+ .map((t) => {
7070+ // Remove optional ! prefix (Moxfield uses #! for "global" tags)
7171+ return t.startsWith("!") ? t.slice(1).trim() : t;
7272+ }),
7373+ ),
7474+ );
7175 }
72767377 // Parse quantity (default to 1 if not present or invalid)