Skip to content

Commit f5e3f6e

Browse files
authored
Revert "chore: updated react-virtual package" (#795)
This reverts commit ad174ce.
1 parent e2c8c55 commit f5e3f6e

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@tailwindcss/vite": "^4.1.18",
3232
"@tanstack/react-query": "^5.90.12",
3333
"@tanstack/react-query-devtools": "^5.91.1",
34-
"@tanstack/react-virtual": "^3.13.13",
34+
"@tanstack/react-virtual": "^3.13.12",
3535
"@tensorflow/tfjs": "^4.22.0",
3636
"@types/recharts": "^2.0.1",
3737
"class-variance-authority": "^0.7.1",

frontend/src/components/CardsTable.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useVirtualizer } from '@tanstack/react-virtual'
22
import i18n from 'i18next'
3-
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
3+
import { type ReactNode, useEffect, useMemo, useRef, useState } from 'react'
44
import { useTranslation } from 'react-i18next'
55
import { getExpansionById } from '@/lib/CardsDB.ts'
66
import { chunk, cn } from '@/lib/utils.ts'
@@ -75,14 +75,10 @@ export function CardsTable({ className, children, cards, groupExpansions, render
7575
[cards, cardsPerRow],
7676
)
7777

78-
const getItemKey = useCallback((index: number) => {
79-
return rows[index].id // critical: stable keys per logical row
80-
}, [])
81-
8278
const rowVirtualizer = useVirtualizer({
8379
getScrollElement: () => scrollRef.current,
8480
count: rows.length,
85-
getItemKey,
81+
getItemKey: (index) => rows[index].id, // critical: stable keys per logical row
8682
estimateSize: (index) => (rows[index].type === 'header' ? 52 : cardHeight + 8),
8783
overscan: 5,
8884
})
@@ -106,7 +102,7 @@ export function CardsTable({ className, children, cards, groupExpansions, render
106102
<img
107103
src={`/images/sets/${i18n.language}/${row.expansion.id}.webp`}
108104
alt={row.expansion.name}
109-
className="max-w-15"
105+
className="max-w-[60px]"
110106
onError={(e) => {
111107
;(e.target as HTMLImageElement).src = `/images/sets/en-US/${row.expansion.id}.webp`
112108
}}

frontend/src/pages/trade/TradeMatches.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useVirtualizer } from '@tanstack/react-virtual'
22
import { ChevronRight } from 'lucide-react'
3-
import { useCallback, useMemo, useRef, useState } from 'react'
3+
import { useMemo, useRef, useState } from 'react'
44
import { useTranslation } from 'react-i18next'
55
import { Link } from 'react-router'
66
import { CardLine } from '@/components/CardLine'
@@ -22,14 +22,10 @@ function TradeMatches() {
2222

2323
const { data: tradingPartners, isLoading, isError } = useTradingPartners(showResults, selectedCard)
2424

25-
const getItemKey = useCallback((index: number) => {
26-
return cards[index].card_id
27-
}, [])
28-
2925
const virtualizer = useVirtualizer({
3026
getScrollElement: () => scrollRef.current,
3127
count: cards.length,
32-
getItemKey,
28+
getItemKey: (index) => cards[index].card_id,
3329
estimateSize: () => 32,
3430
})
3531

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)