LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtNov 15, 2026, 1:51 AM
updatedAtNov 15, 2026, 12:15 PM
githubUrlhttps://github.com/neomjs/neo/issues/20985
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[ ] 20974 A container''s bulkUpdateRecords writes one store batch
closedAtNov 15, 2026, 12:15 PM

A row batch misses a TreeStore's collapsed rows and skips its re-sort

neo-opus-grace
neo-opus-grace commented on Nov 15, 2026, 1:51 AM

Context

#20968 (PR #20975, merged as 8c42dc1d46) added Neo.data.Store#updateRows(changes): Turbo Mode rows written in place, hydrated records published with isBatch: true, opted-in filters and sorters reapplied once, one rowsChange. Its specs cover flat stores. A grouped store built on TreeStore in a package found that the same batch fails on a tree, and the merged code confirms it.

Reproducer: Node, a Turbo Mode TreeStore (autoInitRecords: false) on the merged code (#20975's head 5b3f4e5269). Rows p (collapsed), its child c1, and two roots a (score 1) and b (score 2); the second store sorts by score with reapplyOnRecordChange: true.

updateRows([{key: 'c1', values: {name: 'Child, edited'}}])
→ {missing: ['c1']}                     the store holds c1; the batch does not write it
updateRows([{key: 'a', values: {score: 3}}])
→ order a,b,p before and after          no re-sort; one row hydrated (0 records → 1)

The Problem

  1. A row under a collapsed parent is reported missing and never written. A grouped view that starts collapsed writes nothing.
  2. An opted-in sorter never reapplies after a tree batch, and the check hydrates the row it reads, which the batch exists to avoid.
  3. Nothing says how a subclass names the rows it rewrites. A writeRows override that appends to rows after super.writeRows() already reaches rowsChange (measured during the build), but neither writeRows nor the event documents it, so a store that derives rows (a grouped store's group rows) cannot rely on it.
  4. An opted-in filter reapplies for any written field. Sorters already check whether the batch wrote a field they read; filters refilter the whole store even when no filter reads a written field. With a cross-filter opted in, a store of 100,000 rows refilters on every batch.

The Architectural Reality

Design authority: updateRows's JSDoc: "one the store does not hold is skipped, a filtered-out row is held" and "Opted-in filters or sorters (reapplyOnRecordChange) then reapply once" (src/data/Store.mjs:1793–1808 at 5b3f4e5269).

  • The lookup: updateRows finds rows in (me.allItems || me).map (:1814, :1820). TreeStore keeps its complete rows in its Structural Layer, #allRecordsMap, and bypasses allItems entirely (src/data/TreeStore.mjs:20–22, :78, :199–201), so its map holds only the visible projection.
  • The re-sort check: shouldReapplySorters reads the row through me.get(key) in a tree store (Store.mjs:1729), which hydrates a raw row into a new record, so current === record is false and the batch skips its sort.
  • The event: rowsChange fires with keys: rows.map(row => row.key) (:1862), after writeRows(rows) (:1877), the subclass hook, so rows it appends are reported; neither JSDoc says so.
  • The filter check: shouldReapplyFilters(record) (:1702–1708) asks only whether an opted-in filter exists, while shouldReapplySorters matches the written fields against each sorter's property (:1723–1725).

The Fix

  • One protected row lookup that never hydrates, used by updateRows and by shouldReapplySorters; TreeStore answers it from its Structural Layer.
  • writeRows documents how a subclass adds rows to the batch, so one that rewrites derived rows names them in the one rowsChange, and the batch's filters and sorters check their fields too.
  • Filters reapply by field, the rule sorters follow: an opted-in property filter reapplies when the batch wrote its property; a filterBy filter, whose reads are opaque, reapplies for any batch.

Acceptance Criteria

  • A Turbo Mode TreeStore batch writes a row under a collapsed parent and returns it in no missing list; the row stays raw (unit).
  • An opted-in sorter reapplies after a tree batch that wrote its field, and the batch hydrates no row (unit).
  • A writeRows override that appends rows sees their keys in the one rowsChange (unit; it pins what dev already does).
  • An opted-in property filter reapplies only when the batch wrote its property; a filterBy filter reapplies for any batch (unit).
  • #20975's specs (StoreUpdateRows.spec.mjs, BodyRowsChange.spec.mjs, StoreUpdateRowsNL.spec.mjs) pass unchanged.
  • Each new spec fails on dev first.

Out of Scope

  • The grid's repaint of rows a tree hides (it follows rowsChange as it does now).
  • record.set() and the single-record path.

Related

#20968 · PR #20975 · #20974 (moves the containers' bulkUpdateRecords onto this batch; blocked by this ticket for tree grids) · #20667 (a package's grouped store builds on the batch)

Live latest-open + all-state sweep: latest open + all-state searches (updateRows TreeStore, rowsChange, batch collapsed, reapplyOnRecordChange filter field) at 2026-11-15T00:51Z; no equivalent; #2392 (closed, 2022) first re-sorted on a record edit. A2A claim sweep: no claim on Store#updateRows since 00:27Z. MC sweep: "TreeStore row batch misses rows under a collapsed parent; updateRows missing keys; sorter check hydrates the row", 5 results, no prior decision found. Own-assignment sweep: #20983 touches the connections, no overlap.

Self-assigned: the defect is in my merged #20975, and it should be fixed before the 14.0.0 cut on Nov 23.

Revised during the build (Nov 15): gap 3 was a missing contract, not a missing path.

Origin Session ID: d1b95760-1346-4533-a464-5e13c1980031

Retrieval Hint: "updateRows TreeStore collapsed rows missing; shouldReapplySorters hydrates; rowsChange subclass keys; field-aware filter reapply"

🖖 Grace (Claude Opus 5.5, Claude Code)

tobiu referenced in commit 2595529 - "fix(data): a row batch finds a TreeStore's collapsed rows and reapplies only what reads its fields (#20985) (#20989) on Nov 15, 2026, 12:15 PM
tobiu closed this issue on Nov 15, 2026, 12:15 PM