LearnNewsExamplesServices
Frontmatter
id9839
titleMulti-Body: Peer State Adoption for Row Selection Synchronization
stateClosed
labels[]
assigneestobiu
createdAtApr 9, 2026, 11:18 PM
updatedAtApr 9, 2026, 11:20 PM
githubUrlhttps://github.com/neomjs/neo/issues/9839
authortobiu
commentsCount1
parentIssue9492
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 9, 2026, 11:20 PM

Multi-Body: Peer State Adoption for Row Selection Synchronization

Closed[]
tobiu
tobiu commented on Apr 9, 2026, 11:18 PM

Context

Phase 6 of the Multi-Body Epic (#9486) involves adapting Selection Models for Split Rows. As identified in parent Epic #9492, the selection models (RowModel, CellModel) need to maintain cross-body synchronization.

Initially, delegating selection state arrays (selectedRows) upward to the GridContainer was considered. However, this causes severe namespace pollution, forcing the GridContainer to orchestrate internal states of independent Selection Model plugins.

Architecture: Peer State Adoption

To maintain encapsulation, we will implement the Peer State Adoption pattern in Neo.selection.grid.BaseModel and RowModel:

  1. Zero GridContainer Pollution: The state arrays remain strictly inside the Selection Models.
  2. Shared State Reference: During register(), a Selection Model will inspect its GridContainer for already instantiated sibling SMs. If a peer exists (e.g., body.selectionModel), the new SM adopts the peer's selectedRows array by reference. This establishes a single state truth across all sub-grid bodies natively via memory pointers.
  3. Cross-Body VDOM Sync: RowModel will bind to gridContainer DOM events. When onRowClick fires, it mutates the shared Array and iteratively invokes updateRows() on all peers, forcing all active bodies (start, center, end) to physically update their neo-selected styling in unison.

Implementation Steps

  1. Refactor Neo.selection.grid.BaseModel to adopt peer arrays.
  2. Refactor Neo.selection.grid.RowModel to sync logical VDOM mutations.
tobiu added parent issue #9492 on Apr 9, 2026, 11:18 PM
tobiu referenced in commit 1161a17 - "feat: Implement Peer State Adoption for Grid Multi-Body Row Selection (#9839)" on Apr 9, 2026, 11:19 PM
tobiu assigned to @tobiu on Apr 9, 2026, 11:19 PM
tobiu
tobiu Apr 9, 2026, 11:19 PM

Input from Antigravity (Gemini 3.1 Pro):

✦ Closed via commit 1161a17ae.

Resolution: Safely implemented the Peer State Adoption architecture on RowModel and BaseModel.

  • The Neo.selection.grid.BaseModel implements getActivePeers() to fetch instantiated sibling states isolated within the GridContainer.
  • RowModel seamlessly adopts the selectedRows array reference on module registration to share true memory points globally across peers.
  • Click events correctly bubble inside isolated active-peer nodes, forcing parallel grid visuals synchronously via native VDOM manipulations without grid pollution.
tobiu closed this issue on Apr 9, 2026, 11:20 PM