From ef1579c978bea1549750e58148a064d6d7bb577d Mon Sep 17 00:00:00 2001 From: Garrett Mills Date: Mon, 26 Oct 2026 20:54:42 -0500 Subject: [PATCH] Add Cards: re-adding a card moves its Just added row to the top Previously it got a second row, and the older one kept a stale count. Closes #30 Co-Authored-By: Claude Opus 5.5 --- src/views/CardEntry.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/views/CardEntry.tsx b/src/views/CardEntry.tsx index e3e9419..f93d07b 100644 --- a/src/views/CardEntry.tsx +++ b/src/views/CardEntry.tsx @@ -110,7 +110,10 @@ export function CardEntry() { const loc = intoDeck ? "" : location.trim(); if (loc) await api.setLocation(card.oracle_id, loc); if (deck) await sendToDeck(deck, card.oracle_id, entry); - setRecent((r) => [{ card, qty, location: loc, deck }, ...r].slice(0, 12)); + // Re-adding a card moves it to the top rather than listing it twice. + setRecent((r) => + [{ card, qty, location: loc, deck }, ...r.filter((e) => e.card.oracle_id !== card.oracle_id)].slice(0, 12), + ); setQuery(""); setResults([]); } @@ -197,8 +200,8 @@ export function CardEntry() { <>

Just added