-
-
Notifications
You must be signed in to change notification settings - Fork 202
RFC: Component-Based Grid Rows (Neo.grid.Row) for Granular Updates #8964
Copy link
Copy link
Closed
17 / 1717 of 17 issues completedClosed
17 / 1717 of 17 issues completed
Copy link
Labels
aiarchitectureArchitecture related issuesArchitecture related issuesenhancementNew feature or requestNew feature or requestepicA big time intense ticket with related sub-tasksA big time intense ticket with related sub-tasks
Description
Current Architecture
Currently, Neo.grid.Body acts as a monolithic renderer. It manages a large VDOM structure representing all visible rows.
- Rendering:
createViewDataiterates through the store and generates a massive array of VDOM objects for rows and cells. - Updates: When a single record changes (
onStoreRecordChange),grid.Bodyoften triggers a fullupdate(), sending the entire grid body VDOM to the worker (though diffing minimizes DOM ops, the serialization/transport cost is O(N)). - Component Columns:
grid.Bodymanually instantiates, updates, and destroys components (like Sparklines) within cells, managing their lifecycle via custom logic (cellRenderer,cleanupComponentInstances).
The Proposal: Neo.grid.Row
Refactor the Grid to use a "Composed Architecture" where each row is a Neo.component.Base instance.
Core Concepts
- Row Component: Create a new class
Neo.grid.RowextendingNeo.component.Base.- Configs:
record,columns,rowIndex,gridContainer. - Reactivity:
afterSetRecordtriggers a VDOM update for only that row instance.
- Configs:
- Row Pooling:
Neo.grid.Bodymaintains a fixed pool ofNeo.grid.Rowinstances (based onavailableRows+ buffer).- Scrolling: Instead of regenerating VDOM objects,
grid.Bodyupdates the configs of existing Row components (row.set({ record: newRecord, rowIndex: newIndex })).
- Scrolling: Instead of regenerating VDOM objects,
- Container Composition:
grid.Bodymanages these rows as standarditems.
Benefits
- Granular Updates (O(1)): A record update triggers a VDOM update only for the specific
Neo.grid.Rowinstance. The parentgrid.Bodydoes not need to re-render or diff the entire table. - Simplified Lifecycle: Component columns (Sparklines, Widgets) become standard children of the
Rowcomponent. Their lifecycle (mount/unmount) is handled automatically by the framework's standard component tree logic, removing the fragile manual management ingrid.Body. - Cleaner Architecture: Separation of concerns.
grid.Bodymanages the viewport and scrolling.grid.Rowmanages the content and cell rendering. - Stability: Eliminates "Zombie Canvas" and context-loss bugs caused by manual VDOM manipulation, as the framework ensures component state persistence.
Challenges / Considerations
- Memory Overhead: Creating ~50 component instances vs raw VDOM objects. (Deemed negligible for modern apps).
- Initial Render: Instantiation time for the row pool.
- Refactoring: Significant changes to
Neo.grid.Body,Neo.grid.column.Base(renderers might need adjustment), and CSS targeting (ensuringNeo.grid.Rowrenders the correct class/structure).
Implementation Strategy
- Prototype
Neo.grid.Row: Create the class and ensure it can render a record given a set of columns. - Refactor
Neo.grid.Body:- Remove
createRowVDOM generation. - Implement
createRowPoolto instantiate components. - Update
onStoreRecordChangeto find the matching Row component and callset(). - Update scrolling logic to recycle Row components instead of VDOM nodes.
- Remove
Future Potential
- Drag & Drop: Row reordering becomes standard component drag-and-drop.
- Row Expansion: Implementing "Row Expander" (nested grids/details) becomes trivial (just adding items to the Row component).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
aiarchitectureArchitecture related issuesArchitecture related issuesenhancementNew feature or requestNew feature or requestepicA big time intense ticket with related sub-tasksA big time intense ticket with related sub-tasks