LearnNewsExamplesServices
Frontmatter
id19966
titleAn update landing after unmount() marks the root's children mounted
stateClosed
labels
bugaicoregrid
assigneesneo-opus-ada
createdAtOct 21, 2026, 7:09 PM
updatedAtOct 21, 2026, 10:43 PM
githubUrlhttps://github.com/neomjs/neo/issues/19966
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 21, 2026, 10:43 PM

An update landing after unmount() marks the root's children mounted

Closed Backlog/active-chunk-10 bugaicoregrid
neo-opus-ada
neo-opus-ada commented on Oct 21, 2026, 7:09 PM

Context

The #19928 arm in test/playwright/e2e/grid/IssuesShowcase.spec.mjs ("the filter list draws its focus ring inside the row and its rows on the menu surface, in both themes") flakes in e2e-engine (3/4). After its second pick ("Duplicate", after Escape and a theme switch), .neo-navigator-active-item is never found. It failed twice on #19964 (jobs 119302106742 and 119305785537) and earlier on #19958 and #19960. #19962 fixed one cause, a late search focus. At its head (9fc08da9a9), the arm still failed 5 of 24 runs locally under 8 workers.

Measured with a probe spec that replays the arm's exact sequence (local headless Chromium, playwright.config.e2e.mjs, same head):

  • In every failing run, the reopened menu's value list never calls Neo.main.addon.Navigator.subscribe. In every passing run it does, about 1 ms after the menu mounts.
  • A worker-side hook on Neo.list.ValuePicker#afterSetMounted records each transition with its stack. Passing: mount (first open), unmount (Escape: hide() → unmount() → container cascade), mount (reopen, via initVnode). Failing: mount, unmount, then mount via syncVnodeTree < executeVdomUpdate, an update flight landing ~1 ms after the unmount. The reopen finds the list already mounted: true, so afterSetMounted never fires and the new DOM is never subscribed.
  • At the failure, the App worker reports the list mounted: true, hasNavigator: true and its element is in the DOM, without the Navigator's listeners.
  • The flight is the surface's own. The first pick shows the Clear button (refreshOptions → clear.hidden = false → surface.update()), and Escape lands while that flight is out. The arm's soft.poll(read) between the first pick and Escape (14–46 ms) puts Escape inside the window: replicas without that poll passed all 98 runs, and with it 4–5 of 24 failed, in each of three runs.
  • Holding the list's subscribe on the main thread until after the click reproduces the symptom 10/10.

The Problem

Component#hide() on a component rooted at document.body calls unmount(), which sets mounted = false synchronously, and Container#afterSetMounted cascades that to the items: the value list unsubscribes from the Navigator. An update flight that left before the unmount still lands. executeVdomUpdate hands its vnode to syncVnodeTree, which sets mounted = true on every child component the vnode carries, without asking whether the root's DOM still exists. The children end up mounted: true under an unmounted root. When the root mounts again, the container cascade finds nothing to change, so no child's afterSetMounted(true) runs. The list never re-subscribes, and any other mount-time setup in those children is skipped too.

In the grid, a header menu closed inside that window and then reopened has no keyboard navigation and no focus ring in its value list, until the next close and reopen. The same code path applies to any document.body-rooted component hidden while one of its updates is in flight. That is inferred from the code; only the header menu is measured.

The Architectural Reality

  • src/component/Base.mjs: hide() → unmount() sets vdom.removeDom = true, mounted = false and sends a removeNode delta.
  • src/container/Base.mjs: afterSetMounted() cascades mounted to items without removeDom.
  • src/mixin/VdomLifecycle.mjs: the executeVdomUpdate() landing calls component.syncVnodeTree(vnode, deltas) for each root, and guards only destroyed roots (the #19830 precedent). syncVnodeTree() sets component.mounted = true for each child found in the vnode.
  • updateVdom() already refuses to start a flight on an unmounted root (it waits for mountedPromise). The only flight that can land on an unmounted root is one that left before unmount().
  • src/list/Base.mjs: afterSetMounted() subscribes to Neo.main.addon.Navigator on true and unsubscribes on false.
  • Design authority: Component#show()'s JSDoc says "A component rooted at document.body mounts in one flight at a time, which lands on the latest hidden". hide() says "A node still in its mount flight does not exist yet: the flight unmounts it when it lands". A mount flight already honours a hide() that arrives while it flies. An update flight does not.

The Fix

syncVnodeTree() marks the children it finds as mounted only while the root's DOM is live: me.mounted || !me.vdom.removeDom. A flight that lands after unmount() still adopts its vnodes but mounts nothing. The root's next mount does that, so every child's afterSetMounted(true) runs again. First renders are unaffected, because show() deletes removeDom before initVnode(true), and domWithheld (toolbar overflow only) never renders a document.body root.

Acceptance Criteria

  • AC-1: An update flight that lands after its root's unmount() leaves the root's child components mounted: false, and the root's next mount runs each child's afterSetMounted(true).
  • AC-2: A grid header menu closed while its surface update is in flight, then reopened, marks the picked value with .neo-navigator-active-item.
  • AC-3: Both are deterministic, red on base and green at head: a unit test for AC-1 and a browser e2e for AC-2.
  • AC-4: Under the measured load (8 workers, 24 runs), the #19928 arm fails on base and passes every run at head. This is an outside-CI receipt.

Out of Scope

  • The other flakes seen on #19964: HeaderMenuShape.spec.mjs:133 (now #19965), PremeasureRows.spec.mjs:76 and SpawnAnimation.spec.mjs:183.
  • Whether a non-container root's unmount() should also unmount child components embedded in its vdom.

Related

#19928 · #19961 · #19962 · #19964 · #19830 · #19965

Live latest-open sweep: checked the latest 20 open issues at 2026-10-21T17:08:11Z; no equivalent found (#19965 is a createDeltas root mismatch when enabling columnMenu at runtime, a different mechanism). A2A sweep: the last 30 messages, all read-states; Maryam's #19965 lane-claim is the only grid claim and does not overlap. MC sweep: one query on the symptom ("hidden while update in flight stays mounted, reopen skips afterSetMounted, navigator not subscribed"), 6 results. The nearest are #18290 (floating focus-leave) and #19921 (a throwing mount hook); neither ruled on this. KB sweep: #16434, #19830 and #19922 are closed, with different mechanisms. Own-assignment sweep: 6 open, none overlapping.

Origin Session ID: 7ae4513c-24be-4f11-864b-167a32b15bd1

Retrieval Hint: "update flight lands after unmount, syncVnodeTree marks children mounted, header menu reopened loses navigator active item"

tobiu closed this issue on Oct 21, 2026, 10:43 PM
tobiu referenced in commit 0c7ccd5 - "fix(vdom): an update landing after unmount() leaves the children unmounted (#19966) (#19967) on Oct 21, 2026, 10:43 PM
tobiu referenced in commit f48dde0 - "fix(vdom): an update landing after an ancestor's unmount() mounts no child (#19969) (#19970) on Oct 22, 2026, 12:14 AM