npm / react-virtuoso
react-virtuoso
What changed in react-virtuoso 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-21.
1 breaking3 new APIs and options15 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initreact-virtuoso 419 changes
Breaking changes 1
In GroupedVirtuoso and GroupedTableVirtuoso, the callback now receives the index of the last real item rather than an index including group headers, and no longer fires when every group is empty.
New APIs and options 3
A custom List wrapper can render a ul instead of a div, with its forwarded ref typed to the chosen element; Item is unchanged.
Adds a prop to ensure a minimum number of items are rendered before and after the viewport, useful when pixel-based overscan is insufficient for tall or collapsible items.
Adds support for specifying a fixed size for groups in grouped virtuoso.
Fixes and other changes 15
VirtuosoGrid clamps out-of-range scrollToIndex targets to the last available item.
The initial size probe stays within existing items, avoiding calls to computeItemKey and itemContent with a non-existent index; empty groups probe only headers and reset size state when items arrive.
TableVirtuoso now passes this optional prop to its resize observer instead of leaving it as a leftover prop on the scroller DOM.
Clamps the initial item count to available data, renders no items for explicitly empty data, and recomputes list state when the value changes after mount.
The compensating scroll now runs from a layout effect after the renderer acknowledges the DOM mutation, preventing a painted frame where the list is displaced by the prepended page.
Window-scrolling lists are measured before entering the viewport so their estimated height is included in the document layout.
Explicit undefined initial top-most item index values no longer crash when empty data updates to an object-form initial index.
The initial top-most item index is clamped to the available range, preventing out-of-range values from starting the list at a blank or mid-list position.
A default-positioned
{ index: 0 }is treated like0, avoiding a redundant initial scroll and delayedfollowOutput.The location object passed to
scrollToIndexis no longer mutated; defaults are applied to a shallow copy.Scroll target indexes beyond the available items are clamped to the last available item.
Fixed horizontal Virtuoso item positioning and scrolling in RTL layouts.
Fixes SSR layout collapse by rendering the window viewport in normal flow while preserving sticky top items.
React 19+ now correctly uses useSyncExternalStore instead of falling back to the legacy useState+useLayoutEffect subscription path, avoiding potential tearing in concurrent rendering.
Fixes atBottomStateChange in useWindowScroll lists when the Virtuoso instance is rendered below other page content.