mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-27 06:13: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)))
|
const extra = appended.pages.flat().filter((row) => !seedKeys.has(rowKey(row)))
|
||||||
return [...rows, ...extra]
|
return [...rows, ...extra]
|
||||||
}, [rows, appended.pages, rowKey])
|
}, [rows, appended.pages, rowKey])
|
||||||
const loadedRowsRef = useRef(loadedRows)
|
|
||||||
loadedRowsRef.current = loadedRows
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setScrollElement(rootRef.current?.closest(CAMPAIGN_CONTENT_SCROLL_SELECTOR) ?? null)
|
setScrollElement(rootRef.current?.closest(CAMPAIGN_CONTENT_SCROLL_SELECTOR) ?? null)
|
||||||
|
|
@ -256,16 +254,13 @@ export const CampaignInfiniteTable = <Row,>({
|
||||||
|
|
||||||
const virtualizer = useVirtualizer({
|
const virtualizer = useVirtualizer({
|
||||||
count: itemCount,
|
count: itemCount,
|
||||||
estimateSize: useCallback(() => ESTIMATED_ROW_HEIGHT, []),
|
estimateSize: () => ESTIMATED_ROW_HEIGHT,
|
||||||
getScrollElement: useCallback(() => scrollElement, [scrollElement]),
|
getScrollElement: () => scrollElement,
|
||||||
overscan: 8,
|
overscan: 8,
|
||||||
getItemKey: useCallback(
|
getItemKey: (index) => {
|
||||||
(index: number) => {
|
const row = loadedRows[index]
|
||||||
const row = loadedRowsRef.current[index]
|
return row ? rowKey(row) : `skeleton-${index}`
|
||||||
return row ? rowKey(row) : `skeleton-${index}`
|
},
|
||||||
},
|
|
||||||
[rowKey],
|
|
||||||
),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const virtualItems = virtualizer.getVirtualItems()
|
const virtualItems = virtualizer.getVirtualItems()
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,14 @@ test.describe('campaign leaderships list', () => {
|
||||||
name: 'Buscar município, território de identidade ou zona eleitoral',
|
name: 'Buscar município, território de identidade ou zona eleitoral',
|
||||||
})
|
})
|
||||||
await search.fill(added.name)
|
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
|
const suggestion = page
|
||||||
.getByRole('option')
|
.getByRole('option')
|
||||||
.filter({ has: page.getByText(added.name, { exact: true }) })
|
.filter({ has: page.getByText(added.name, { exact: true }) })
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue