DynamicScroller (page-mode): ResizeObserver misses async row height changes, leaving stale sizes in cache and causing row overlap/gaps

Author: joeldrakeCreated Sep 23, 2026Updated Sep 23, 2026

Describe the bug

DynamicScroller + DynamicScrollerItem in page-mode intermittently fails to update vscrollData.sizes[id] after a mounted row's DOM height changes. The wrapper's offsetHeight is correct, but the ResizeObserver-driven measurement path doesn't fire (or is swallowed), so the layout keeps using the stale/initial size — producing overlapping rows or gaps.

  1. Are there known cases where the internal ResizeObserver misses size updates in page-mode?
  2. Would it be reasonable to expose a public remeasureVisible() on DynamicScroller (equivalent of the workaround above) so consumers don't need to touch $_vs_id/$_vs_onResize?

Reproduction

Setup

xml
<DynamicScroller
  :items="items"
  key-field="gtin"
  :min-item-size="96"
  page-mode
>
  <template #default="{ item, active }">
    <DynamicScrollerItem :item="item" :active="active">
      <MyRow />
      <FooterHint v-if="showHint(item)" />  <!-- appears async when data loads -->
    </DynamicScrollerItem>
  </template>
</DynamicScroller>
  • ~500 items, async-populated per-item data (Apollo).
  • FooterHint is rendered conditionally after the async data resolves for a row, growing the wrapper from 96 px → 120 px.

Steps to reproduce

  1. Mount the list; async data begins loading.
  2. Scroll into a range where several rows will show FooterHint.
  3. Observe layout while the async data lands.

Expected

Wrapper offsetHeight change (96 → 120) triggers the internal $_vs_onResize, vscrollData.sizes[id] is updated, following rows shift down. Layout is gap/overlap free.

Actual

  • Wrapper offsetHeight is correctly 120 px.
  • The .vue-recycle-scroller__item-view height and translateY for subsequent items are computed with the stale 96 px cache.
  • Result: rows overlap by ~24 px (or gap in the opposite direction after column resize).
  • Same behavior after column-resize on parent grid: some pool items keep their old cached size even though their DOM offsetHeight has grown.

Layout snapshot (simplified):

item[0]  y=2880  offsetHeight=120  layoutSize=120  ✔
item[1]  y=3000  offsetHeight=120  layoutSize=96   ✘ overlap
item[2]  y=3096  offsetHeight=120  layoutSize=96   ✘ overlap

Notes / probable cause

  • ResizeObserver is attached (wrapper.$_vs_id and wrapper.$_vs_onResize are set on the inner div).
  • Manually calling wrapper.$_vs_onResize(wrapper.$_vs_id, w, h) for each mounted .vue-recycle-scroller__item-view immediately corrects the layout — so V() → W() → vscrollData.sizes[id] = h works fine when it's invoked. The RO callback simply isn't firing for these size changes.
  • This happens most often when:
    • the wrapper's first ResizeObserver observation happened before the async content mutation, and
    • the mutation happens while the parent (bobmono-ica-table custom element with grid-template-columns) is also relayouting.
  • forceUpdate(true) makes it worse: it resets every row to min-item-size but the RO still doesn't re-measure, so the whole list collapses to min-item-size height.

Workaround

After column-resize, compact-toggle, and on useScroll idle, iterate the mounted pool and re-invoke $_vs_onResize with the current offsetHeight:

typescript
scrollerEl.querySelectorAll('.vue-recycle-scroller__item-view').forEach((iv) => {
  const wrapper = iv.firstElementChild;
  wrapper?.$_vs_onResize?.(wrapper.$_vs_id, wrapper.offsetWidth, wrapper.offsetHeight);
});

This is obviously reaching into internal properties and shouldn't be necessary.

System Info

bash
`[email protected]`, Vue 3.5, Chrome/Safari on macOS.

Used Package Manager

npm

Validations

Source: Akryum/vue-virtual-scroller