LearnNewsExamplesServices
Frontmatter
id9017
titleRefactor Grid.Body to extend Component.Base and use internal Row Pool
stateClosed
labels
airefactoringarchitecture
assigneestobiu
createdAtFeb 6, 2026, 6:39 PM
updatedAtFeb 6, 2026, 6:57 PM
githubUrlhttps://github.com/neomjs/neo/issues/9017
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 6, 2026, 6:57 PM

Refactor Grid.Body to extend Component.Base and use internal Row Pool

Closed v12.0.0 airefactoringarchitecture
tobiu
tobiu commented on Feb 6, 2026, 6:39 PM

Objective: Revert Neo.grid.Body inheritance from Neo.container.Base to Neo.component.Base. The new "Fixed-DOM-Order" Row Pooling strategy renders the Container API (add, remove, layout) unsafe and redundant.

Changes Required:

  1. Inheritance:

    • Change src/grid/Body.mjs to extend Neo.component.Base.
  2. Row Pool Management:

    • Replace the items config with a private/protected class field (e.g., items = []) to store Neo.grid.Row instances.
    • Update createRowPool to instantiate rows with:
              parentId: me.id,
        appName : me.appName,
        windowId: me.windowId,
        theme   : me.theme
  3. Lifecycle Management:

    • Implement destroy() to manually iterate and destroy row instances in this.items.
  4. Config Propagation (Container Behavior Mimicry):

    • Implement afterSetAppName, afterSetMounted, afterSetTheme, and afterSetWindowId.
    • These methods must iterate over this.items and update the corresponding properties on the row instances, ensuring correct state propagation (theme changes, window moves, etc.).
  5. Verification:

    • Ensure Neo.manager.Component methods (down, query) still function correctly by relying on the parentId link.

Why: To enforce API safety by hiding inapplicable container methods and to remove the overhead of unused layout/container logic in the highly performance-sensitive grid body.

tobiu added the ai label on Feb 6, 2026, 6:39 PM
tobiu added the refactoring label on Feb 6, 2026, 6:39 PM
tobiu added the architecture label on Feb 6, 2026, 6:39 PM
tobiu referenced in commit 12fa73c - "refactor: Upgrade Grid.Body to use internal Row Pooling (Component vs Container) (#9017)" on Feb 6, 2026, 6:56 PM
tobiu
tobiu Feb 6, 2026, 6:56 PM

Input from Gemini 3 Pro:

✦ I have refactored Neo.grid.Body to extend Neo.component.Base instead of Neo.container.Base. This enforces API safety by hiding inapplicable container methods (add, remove, layout) and removes the overhead of unused logic.

Key Changes:

  1. Inheritance: Changed parent class to Neo.component.Base.
  2. Row Pool: Replaced items config with a protected items array.
  3. Lifecycle: Implemented destroy() to manually destroy row instances.
  4. Propagation: Implemented afterSetAppName, afterSetTheme, afterSetWindowId, and afterSetMounted to manually propagate state to the row pool.
  5. Creation: Updated createRowPool to manually instantiate rows with full context.
  6. Documentation: Updated JSDoc to reflect the architectural shift and the reasoning ("Row Manager" role).

I verified the changes against the demos, and no regressions were found. The code has been pushed to dev.

tobiu assigned to @tobiu on Feb 6, 2026, 6:56 PM
tobiu closed this issue on Feb 6, 2026, 6:57 PM
tobiu cross-referenced by #9018 on Feb 6, 2026, 7:09 PM
tobiu cross-referenced by #9019 on Feb 6, 2026, 7:14 PM