Guides
Performance
ProGrid virtualizes rows always and columns when there are many, and memoizes every row and cell. The rest of the budget is yours: stable inputs, the right data mode, and knowing which features cost what.
What the grid does for you
- Row virtualization is always on. Only the rows inside the viewport (plus a small overscan) are mounted, whatever the dataset size.
rowHeightseeds the estimate; rows may still grow to fit content. - Column virtualization switches on above 20 visible columns. Wide grids are dominated by column count: a 50-column projection would put thousands of cells in the DOM when a dozen are on screen. Set
columnVirtualization={false}only when you need every column mounted — printing, or dragging a column past the edge of the viewport. - Memoized rows and cells. Body rows and cells are memoized and re-render only when their own row, selection or layout changes, and the filtered row model is throttled so a burst of quick-filter keystrokes or live updates commits once, not once per event.
- Optional dependencies load late. Recharts is imported when the chart dialog opens, not when the grid mounts, and the calendar behind date filters loads the first time one is opened.
Keep the inputs stable
A data grid is a large memoized tree. It stays fast as long as the props it keys on keep their identity between renders. Three rules cover nearly every regression we have seen:
// Module scope: created once, never re-created on render.
const columns: ProColumnDef<Order>[] = [ /* … */ ]
const getRowId = (order: Order) => order.id
export function Orders({ orders }: { orders: Order[] }) {
// Derived data is memoized, so the grid sees the same array until orders change.
const rows = useMemo(() => orders.filter((o) => !o.archived), [orders])
return <ProGrid columns={columns} data={rows} getRowId={getRowId} />
}- Define
columnsat module scope or memoize them. A new array on every render forces TanStack to rebuild its column model and ProGrid to re-derive filters, groupable dimensions and pivot fields. - Give
getRowIda data-derived key, never the array index. Selection, expansion, live updates and persisted state all match rows by id. - Memoize
datawhen you derive it. An inlinerows.slice()is a new array every time — and withliveUpdateson, a new array discards every applied transaction.
Pick the right data mode
Client mode sorts, filters, groups and pivots in the browser, which is instant up to a few tens of thousands of rows and then increasingly not. Past that point the expensive work belongs on the server, and the grid’s query model is designed so switching costs one prop.
// Above a few tens of thousands of rows, stop shipping the dataset to the browser.
<ProGrid
columns={columns}
dataSource={ordersSource} // sort, filter, search and page on the server
serverOperators={ordersSource.supportedOperators}
pagination={{ mode: "pages", pageSize: 100 }}
/>In server mode the grid owns request cancellation — a sort change while a page is loading aborts the stale request — and paging keeps the DOM bounded. See server-side data for the query contract.
What each feature costs
- Grouping builds the tree once per data or grouping change. Under live updates, aggregates recompute on a throttle (
aggMillis) rather than on every commit, because aggregating the whole filtered dataset — not rendering — is the dominant cost at feed rates. Deep hierarchies over very large client datasets are the first thing to move server-side. - Pivot is computed from the filtered rows on every configuration change and capped by
pivotOptions.limits(maxColumnLeaves,maxRowNodes) so a high-cardinality column dimension cannot explode the output. - Cell range selection is a pair of coordinates, not per-cell state; dragging across ten thousand rows is free.
- Persistence writes on a debounce (
persist.debounceMs, default 300 ms), not on every keystroke, and restores once after mount. - Detail panels (
renderDetail) are measured dynamically. Keep them light, or lazy-load their content, because an expanded row is a tall row.
Tuning live feeds
A feed that patches rows several times a second is bounded by three knobs: how often batches commit, how often totals recompute, and how long cells flash. The defaults suit an order book; a slower dashboard can relax all three.
<ProGrid
liveUpdates={{
batchMillis: 120, // coalesce a burst of applyTransactionAsync calls into one commit
aggMillis: 500, // recompute totals at most twice a second (default 250)
flashMillis: 600, // shorter flash, fewer overlapping animations
maxRows: 5000, // cap the buffer a feed can grow the grid to
}}
/>Push updates through applyTransactionAsync and let the grid coalesce them. Calling the synchronous applyTransaction on every socket message commits on every message.
Measuring
- Profile with React DevTools with “Highlight updates” on: a scroll should repaint body rows only.
- Watch the footer’s row count while typing in the quick filter — it should update once per settled keystroke, not per character.
- The live market grid streams hundreds of updates a second into a grouped, sorted grid; it is the reference for what a healthy live feed looks like.