npm / react-virtuoso
react-virtuoso
What changed in react-virtuoso 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-20.
3 breaking6 new APIs and options1 performance20 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initreact-virtuoso 429 changes
Breaking changes 3
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.
Deprecated props from v0.x no longer work.
The top list element is now first in the container.
New APIs and options 5
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.
The Components interface now accepts data and context generics.
Item components in lists and tables can receive data.
Performance 1
Performance in React 18 is improved.
Fixes and other changes 20
Prevents a list from jumping back to the bottom when scrolling up after an item shrinks.
Fixes first-item offsets in lists with a gap so restoring state does not drift and index-zero scrolling respects explicit offsets and headers.
Fixed item drift, growing blank space, and
endReachedfailures for lists usingcustomScrollParentoruseWindowScrollinside an element with CSSzoom.Fixed initialTopMostItemIndex and scrollToIndex having no effect inside VirtuosoMockContext; the scroller now reports the requested scroll position directly so the list renders the target items in tests.
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.
Tree shaking works.
react-virtuoso 31 changes
New APIs and options 1
VirtuosoGrid supports data and accepts a second generic inferred from the data type.