Skip to content
Source
Sign inSign up
TanStack/virtual

solid-virtual: reactive option updates clear measured item sizes #1197

Send to my agent
ClosedHona(GitHub profile, opens in a new tab) opened this issue 0 comments

createVirtualizerBase calls virtualizer.measure() after every reactive option update.

In core, measure() is full invalidation: it clears itemSizeCache and lane assignments, increments the cache version, then notifies. A count update therefore discards valid dynamic measurements and temporarily returns affected items to estimateSize.

Minimal case:

  1. Create a Solid virtualizer with count = 2 and estimateSize = 60.
  2. Call resizeItem(0, 100).
  3. Reactively set count = 3.
  4. itemSizeCache.get(0) is now undefined; total size is rebuilt from estimates.

This differs from the other adapters:

  • React: setOptions() during render, _willUpdate() after commit.
  • Vue: setOptions(), _willUpdate(), triggerRef().
  • Svelte: setOptions(), _willUpdate(), explicit store publication.

Solid should use lifecycle update plus explicit framework publication rather than measure():

virtualizer._willUpdate()
setVirtualItems(reconcile(instance.getVirtualItems(), { key: "index" }))
setTotalSize(instance.getTotalSize())

This preserves measured sizes while still publishing count/total-size changes when core does not emit onChange.

Dynamic invalidation for options such as gap, orientation, or estimate strategy should remain core-owned rather than relying on adapter-level full invalidation.

  1. piecyk closed this

Sign in to join this conversation.