LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtOct 26, 2026, 3:11 PM
updatedAtOct 26, 2026, 5:05 PM
githubUrlhttps://github.com/neomjs/neo/issues/20124
authorneo-gemini-julia
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 26, 2026, 5:03 PM

ScrollManager isScrolling toggle launches colliding child VDOM flight

Closed v13.4.0/archive-v13-4-0-chunk-3 bugaiperformancegrid
neo-gemini-julia
neo-gemini-julia commented on Oct 26, 2026, 3:11 PM

Context

Captured during 2D big-data scroll benchmarking (defect-note: src/grid/ScrollManager.mjs is wrong in MESSAGE:8cf6fe49-e406-4675-bbde-08d9db41499e): on both scroll start (ScrollManager#onContainerScroll) and scroll end (ScrollManager#onScrollEnd), setting body.isScrolling before me.syncGridBody() launches an independent depth-1 VDOM flight on each grid body (bodyStart, bodyEnd, body) right before View#syncBodies calls view.update().

  • Live latest-open sweep: checked latest 20 open issues in neomjs/neo at 2026-10-26T14:09:53Z (#20114..#19139); no equivalent found
  • A2A in-flight claim sweep: checked latest 30 messages (status: 'all') at 2026-10-26T14:09:48Z; no overlapping claim found
  • MC sweep: "ScrollManager onContainerScroll isScrolling syncGridBody syncBodies ScrollFlightMerge 18439 18719", 6 results, no prior decision found (#18439 / #18719 fixed sparse pruning when a body update merges into an already-in-flight View update via denseUpdate, leaving the idle-View child-before-parent collision on scroll start and scroll end untouched)
  • Own-assignment sweep: 0 open in neomjs/neo, none overlapping

The Problem

When a grid begins scrolling from rest (view.isVdomUpdating === false && view.needsVdomUpdate === false) or settles in ScrollManager#onScrollEnd (150 ms after the last scroll event, when view.isVdomUpdating === false):

  1. ScrollManager#onContainerScroll (src/grid/ScrollManager.mjs:203-205, 225-227) and ScrollManager#onScrollEnd (src/grid/ScrollManager.mjs:245-247) assign isScrolling = true / false directly on container.bodyStart, container.bodyEnd, and container.body before calling me.syncGridBody().
  2. Body#afterSetIsScrolling (src/grid/Body.mjs:526-529) calls this.toggleCls('neo-is-scrolling', value), which mutates cls non-silently and calls body.update().
  3. Furthermore, even if isScrolling is updated via setSilent (setting body.needsVdomUpdate = true), View#syncBodies (src/grid/View.mjs:1252) calls _body.set({scrollLeft, scrollTop}) without silent = true; Abstract#set (src/component/Abstract.mjs:532) checks if (!silent && me.needsVdomUpdate) return me.promiseUpdate(), which immediately launches a depth-1 flight on _body before _body.createViewData(true, force) and view.update().
  4. Because view.isVdomUpdating and view.needsVdomUpdate are both false at that instant, body.mergeIntoParentUpdate() returns false and body.executeVdomUpdate() starts immediately at default updateDepth = 1, setting body.isVdomUpdating = true and registering body.id in VDomUpdate.descendantInFlightMap.get(view.id).
  5. Microseconds later in the same synchronous call stack, View#syncBodies (src/grid/View.mjs:1240-1297) proceeds:
    • _body.createViewData(true, force) hits if (me.isVdomUpdating) at src/grid/Body.mjs:799, aborts synchronous row projection, and defers createViewData(true, force) into VDomUpdate.preUpdateMap!
    • view.update() hits view.isChildUpdating() at src/mixin/VdomLifecycle.mjs:1400, detects the in-flight body descendant, and parks view.update() in VDomUpdate.postUpdateQueueMap behind body's depth-1 class-only flight!
  6. As a result, the first scroll frame and onScrollEnd split into two serialized VDOM flights: a depth-1 flight carrying only neo-is-scrolling on body (0 row deltas), followed a full macrotask + worker round-trip later by the deferred createViewData and view.update() row repaint.

The Architectural Reality

Design authority: "The scroll repaints a row's subtree as one silent transaction, so the depth has to reach the cell CONTENTS, not the cell." (src/grid/View.mjs:1278-1279)

  • Neo.grid.View#syncBodies (src/grid/View.mjs:1240-1297) is the single VDOM transaction owner for scroll steps across body, bodyStart, and bodyEnd. It suppresses body-level createViewData during scrollLeft/scrollTop/startIndex updates (_body.skipCreateViewData = true), runs _body.createViewData(true, force) with silent = true, and ships View + all Body instances + all Row and Cell subtrees in one dense update (me.updateDepth = ROW_DISTANCE + me.maxCellDepth, me.denseUpdate = true).
  • When ScrollManager#onContainerScroll and ScrollManager#onScrollEnd update isScrolling via setSilent({isScrolling: true}) / setSilent({isScrolling: false}) on bodyStart, bodyEnd, and body, and View#syncBodies updates scrollLeft/scrollTop via _body.setSilent({scrollLeft, scrollTop}):
    • Abstract#setSilent (src/component/Abstract.mjs:549-553) sets silentVdomUpdate = true around super.set(...).
    • Body#afterSetIsScrolling still runs synchronously, updating cls / vdom.cls via toggleCls('neo-is-scrolling', value) and firing isScrollingChange for listeners (Neo.grid.plugin.AnimateRows), while VdomLifecycle#updateVdom (src/mixin/VdomLifecycle.mjs:1375) records body.needsVdomUpdate = true without launching a colliding depth-1 flight on body.
    • Immediately afterward, me.syncGridBody() -> View#syncBodies updates scrollLeft/scrollTop silently, executes _body.createViewData(true, force) synchronously (body.isVdomUpdating === false), and ships both the neo-is-scrolling class delta on every body and the repainted rows in a single view.update() batch (clearing body._needsVdomUpdate = false via Container#afterSetNeedsVdomUpdate).

The Fix

  1. In src/grid/ScrollManager.mjs:
    • Add #setBodyScrolling(isScrolling) and call it in onContainerScroll (both vertical and horizontal branches) and onScrollEnd to update isScrolling on container.bodyStart, container.bodyEnd, and container.body via setSilent({isScrolling}) (with direct assignment fallback for plain-object unit test doubles).
  2. In src/grid/View.mjs:
    • In syncBodies, change _body.set({scrollLeft, scrollTop}) to _body.setSilent({scrollLeft, scrollTop}) so Abstract#set does not flush a pre-existing _body.needsVdomUpdate as a depth-1 _body.promiseUpdate() flight ahead of me.update().
  3. In test/playwright/unit/grid/ScrollFlightMerge.spec.mjs:
    • Add a unit test verifying that scrollManager.onContainerScroll (from rest) and scrollManager.onScrollEnd do not launch a colliding depth-1 body flight ahead of View#syncBodies, that body.createViewData runs synchronously during onContainerScroll rather than deferring into VDomUpdate.preUpdateMap, and that the neo-is-scrolling class delta and row updates ship together in the single View flight.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Neo.grid.ScrollManager#onContainerScroll & #onScrollEnd (src/grid/ScrollManager.mjs) src/grid/View.mjs:1278-1296 Sets isScrolling via setSilent({isScrolling: Boolean}) on bodyStart, bodyEnd, and body before syncGridBody(), so afterSetIsScrolling updates vdom.cls and fires isScrollingChange while View#syncBodies ships the class and row repaint in one View VDOM flight Direct writes body.isScrolling = true/false outside ScrollManager continue to trigger Body#afterSetIsScrolling -> toggleCls -> body.update() JSDoc on #setBodyScrolling test/playwright/unit/grid/ScrollFlightMerge.spec.mjs
Neo.grid.View#syncBodies (src/grid/View.mjs:1252) src/grid/View.mjs:1278-1296 Calls _body.setSilent({scrollLeft, scrollTop}) inside updateBody so a dirty _body.needsVdomUpdate (e.g. from setSilent({isScrolling})) is not flushed as a separate depth-1 _body.promiseUpdate() before me.update() View#syncBodies ships the entire body + row subtree in its own me.update() at ROW_DISTANCE + maxCellDepth with denseUpdate = true Inline comment in syncBodies test/playwright/unit/grid/ScrollFlightMerge.spec.mjs

Decision Record impact

none

Acceptance Criteria

  • ScrollManager#onContainerScroll (vertical and horizontal branches) and ScrollManager#onScrollEnd set isScrolling via setSilent on bodyStart, bodyEnd, and body, and View#syncBodies uses _body.setSilent({scrollLeft, scrollTop}).
  • Starting a scroll via scrollManager.onContainerScroll when view is idle (view.isVdomUpdating === false) does not set body.isVdomUpdating = true before view.syncBodies(), executes body.createViewData synchronously without deferring to VDomUpdate.preUpdateMap, and ships neo-is-scrolling and repainted rows in a single View VDOM batch.
  • scrollManager.onScrollEnd removes neo-is-scrolling and syncs bodies in a single View VDOM batch without child-update collision.
  • Existing test/playwright/unit/grid/ScrollFlightMerge.spec.mjs and test/playwright/unit/grid/AnimateRowsSteps.spec.mjs pass.

Out of Scope

  • Changing Body#afterSetIsScrolling for direct non-scroll callers (body.isScrolling = true).
  • Modifying VdomLifecycle or VDomUpdate merge/collision semantics (#18439 / #18719).

Avoided Traps

  • Making Body#afterSetIsScrolling unconditionally silent: External callers or unit tests that set body.isScrolling = true without calling View#syncBodies (test/playwright/unit/grid/AnimateRowsSteps.spec.mjs:178) rely on Body#afterSetIsScrolling triggering a body update when no View#syncBodies follows. Using setSilent({isScrolling}) in ScrollManager scopes silence to the exact sites that immediately call me.syncGridBody().

Related

  • #18439 / #18719 (VdomLifecycle#denseUpdate and ScrollFlightMerge.spec.mjs)
  • #17401 (finite updateDepth in View#syncBodies)

Origin Session ID: 27c583d2-51f9-42aa-a711-44d2d2c566f6 Retrieval Hint: "ScrollManager onContainerScroll onScrollEnd isScrolling setSilent syncBodies child update conflict"

tobiu referenced in commit e3e7406 - "fix(grid): ScrollManager isScrolling toggle launches colliding child VDOM flight (#20124) (#20125) on Oct 26, 2026, 5:03 PM
tobiu closed this issue on Oct 26, 2026, 5:03 PM