LearnNewsExamplesServices
Frontmatter
id12758
titlegrid.View-owned single SelectionModel — eliminate per-body model construction
stateClosed
labels
enhancementairefactoringarchitecturegrid
assigneesneo-opus-grace
createdAtJun 8, 2026, 1:05 PM
updatedAtJun 9, 2026, 3:26 AM
githubUrlhttps://github.com/neomjs/neo/issues/12758
authorneo-opus-grace
commentsCount3
parentIssue9492
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 9, 2026, 3:26 AM

grid.View-owned single SelectionModel — eliminate per-body model construction

Closed v13.0.0/archive-v13-0-0-chunk-17 enhancementairefactoringarchitecturegrid
neo-opus-grace
neo-opus-grace commented on Jun 8, 2026, 1:05 PM

Context

Graduated from the PR #12754 cross-family review (@neo-gpt REQUEST_CHANGES, empirical probes at head ca7f58049) + maintainer architectural direction: the multi-body grid SelectionModel must be grid.View-owned, NOT center-body-owned. This is the holistic version of the SM rework that #12754 only partially (and regressively) attempted.

The Problem

Container.createOrUpdateSubGrids() spreads ...me.body.initialConfig into bodyStart (Container.mjs:43-44) and bodyEnd (:78-79), so each locked body receives its own cloned selectionModel instance. The instances are kept coherent only via BaseModel.getActivePeers() fan-out + the register() "Peer State Adoption" — the fragile architecture the #9868 R&D retro condemned. Dynamic grid.body.selectionModel = <Model> changes leave the locked bodies on stale model types.

V-B-A note: user-facing multi-body selection currently works on devGridSelectionMultiBody.spec.mjs cross-body row-selection is green on dev (probe-confirmed, not a stale-server false-green). So this is architecture hardening, not a v13-facing regression. It is post-v13 internal architecture per #9872's "View owning body lifecycle" boundary.

gpt's empirical probes (PR #12754) — use as regression gates

// Construction: all three bodies have independent RowModel instances
{"centerType":"...RowModel","startType":"...RowModel","endType":"...RowModel","centerIsStart":false,"centerIsEnd":false}
// Dynamic toggle (center → CellModel) leaves locked bodies stale:
{"afterCell":{"center":"...CellModel","start":"...RowModel","end":"...RowModel"}}

The Architectural Reality + Fix

  • One SelectionModel owned by grid.View (not the center grid.Body); bodyStart/body/bodyEnd become pure render/event delegates.
  • createOrUpdateSubGrids() stops cloning selectionModel into the locked bodies (drop it from the initialConfig spread).
  • BaseModel.updateRows spans all bodies (the updateBodyRows extraction from #12754's reverted commit ca7f58049 — recover it); delete getActivePeers() + the register() Peer State Adoption.
  • Rework RowModel.onRowClick's event.body === view gating so a locked-body click is owned by the single View model.

Acceptance Criteria

  • Exactly one SelectionModel instance for the grid; start/center/end resolve to the same model (gpt probe 1 inverted).
  • Dynamic grid.body.selectionModel change updates all bodies — no stale model types (gpt probe 2 inverted).
  • A locked-body row click selects via the single View-owned model and renders across all bodies.
  • GridSelectionMultiBody.spec.mjs cross-body test stays green; new unit spec for body-spanning updateRows.

Out of Scope

  • Body-scroll orchestration (syncBodies) — delivered separately (the View body-orchestration leaf / PR #12754).

Related

  • Parent: #9492 (Adapt Selection Models for Split Rows). Refs #9486, #9872.
  • Design: #9868 (R&D retro — the peer-SM failure analysis). Refs #9830 (the bug — works on dev today; this hardens the architecture behind it). Origin PR: #12754.

Decision Record impact

aligned-with #9868 R&D direction.

Origin Session ID: 3f9ffeb7-a284-4783-912b-f39912115d2e Retrieval Hint: "grid.View-owned single SelectionModel eliminate per-body model construction"; PR #12754 review thread.

tobiu referenced in commit 96da8a9 - "refactor(grid): grid.View owns body-scroll orchestration (#12757) (#12754) on Jun 8, 2026, 1:34 PM
tobiu referenced in commit f69b56a - "refactor(grid): grid.View-owned single SelectionModel, eliminate per-body model construction (#12784) on Jun 9, 2026, 3:26 AM
tobiu closed this issue on Jun 9, 2026, 3:26 AM