Fix TDZ crash: move expandedCard declaration before useEffect that references it
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-05-15 22:08:40 +02:00
parent afd02a91ed
commit 74e903775a
+2 -2
View File
@@ -65,6 +65,8 @@ function HomePage() {
totalCopies: cards.reduce((s, c) => s + getTotal(c), 0), totalCopies: cards.reduce((s, c) => s + getTotal(c), 0),
}), [cards, getTotal]); }), [cards, getTotal]);
const expandedCard = cards.find(c => c.id === expandedCardId);
const filteredCards = useMemo(() => { const filteredCards = useMemo(() => {
let result = cards; let result = cards;
if (debouncedSearch) { if (debouncedSearch) {
@@ -83,8 +85,6 @@ function HomePage() {
return sorted; return sorted;
}, [cards, debouncedSearch, typeFilter, ownedOnly, sortBy, getTotal]); }, [cards, debouncedSearch, typeFilter, ownedOnly, sortBy, getTotal]);
const expandedCard = cards.find(c => c.id === expandedCardId);
if (loading) return <p style={{ padding: '1rem', color: '#666' }}>Loading cards</p>; if (loading) return <p style={{ padding: '1rem', color: '#666' }}>Loading cards</p>;
if (error) return <p style={{ padding: '1rem', color: '#c04040' }}>Error: {error}</p>; if (error) return <p style={{ padding: '1rem', color: '#c04040' }}>Error: {error}</p>;