mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
revert: remove useCallback wrappers that caused performance regression
This commit is contained in:
parent
c2229596e4
commit
43949d7c55
2 changed files with 14 additions and 11 deletions
|
|
@ -177,8 +177,6 @@ export const CampaignInfiniteTable = <Row,>({
|
|||
const extra = appended.pages.flat().filter((row) => !seedKeys.has(rowKey(row)))
|
||||
return [...rows, ...extra]
|
||||
}, [rows, appended.pages, rowKey])
|
||||
const loadedRowsRef = useRef(loadedRows)
|
||||
loadedRowsRef.current = loadedRows
|
||||
|
||||
useEffect(() => {
|
||||
setScrollElement(rootRef.current?.closest(CAMPAIGN_CONTENT_SCROLL_SELECTOR) ?? null)
|
||||
|
|
@ -256,16 +254,13 @@ export const CampaignInfiniteTable = <Row,>({
|
|||
|
||||
const virtualizer = useVirtualizer({
|
||||
count: itemCount,
|
||||
estimateSize: useCallback(() => ESTIMATED_ROW_HEIGHT, []),
|
||||
getScrollElement: useCallback(() => scrollElement, [scrollElement]),
|
||||
estimateSize: () => ESTIMATED_ROW_HEIGHT,
|
||||
getScrollElement: () => scrollElement,
|
||||
overscan: 8,
|
||||
getItemKey: useCallback(
|
||||
(index: number) => {
|
||||
const row = loadedRowsRef.current[index]
|
||||
return row ? rowKey(row) : `skeleton-${index}`
|
||||
},
|
||||
[rowKey],
|
||||
),
|
||||
getItemKey: (index) => {
|
||||
const row = loadedRows[index]
|
||||
return row ? rowKey(row) : `skeleton-${index}`
|
||||
},
|
||||
})
|
||||
|
||||
const virtualItems = virtualizer.getVirtualItems()
|
||||
|
|
|
|||
|
|
@ -97,6 +97,14 @@ test.describe('campaign leaderships list', () => {
|
|||
name: 'Buscar município, território de identidade ou zona eleitoral',
|
||||
})
|
||||
await search.fill(added.name)
|
||||
// Diagnostic: check if the listbox is in the DOM
|
||||
const listbox = page.locator('[role="listbox"]')
|
||||
const listboxCount = await listbox.count()
|
||||
console.log(`Listbox count after fill: ${listboxCount}`)
|
||||
if (listboxCount > 0) {
|
||||
const listboxHTML = await listbox.first().innerHTML()
|
||||
console.log(`Listbox HTML: ${listboxHTML.substring(0, 500)}`)
|
||||
}
|
||||
const suggestion = page
|
||||
.getByRole('option')
|
||||
.filter({ has: page.getByText(added.name, { exact: true }) })
|
||||
|
|
|
|||
Loading…
Reference in a new issue