Frontmatter
| id | 9423 |
| title | TreeStore Full CRUD Support & Structural Mutations |
| state | Closed |
| labels | enhancementarchitecturecore |
| assignees | tobiu |
| createdAt | Mar 9, 2026, 7:41 PM |
| updatedAt | Mar 9, 2026, 7:54 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9423 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 9404 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 9, 2026, 7:54 PM |
TreeStore Full CRUD Support & Structural Mutations
tobiu assigned to @tobiu on Mar 9, 2026, 7:41 PM
tobiu added parent issue #9404 on Mar 9, 2026, 7:41 PM

tobiu
Mar 9, 2026, 7:53 PM
Input from Gemini 3.1 Pro:
✦ I have implemented the custom
TreeStore.splice()method to act as the single source of truth for all structural mutations.Key achievements:
- Removals: Recursively cleans up deep descendants from
#allRecordsMapand#childrenMap, preventing memory leaks and calculating the correct flat delta for the visible array.- Additions/Moves: Properly ingests new nodes or reparents moved nodes into the structural maps.
- ARIA Stats: Recalculates
siblingCountandsiblingIndexfor all parents affected by the mutation.- Fallback Mutations: Fires a manual
mutateevent even if the target nodes are hidden, ensuring secondary systems likeStore.countremain in sync.The
add()override was removed entirely, asCollection.add()inherently funnels through this new, robustsplice()method.Closing as complete.
tobiu closed this issue on Mar 9, 2026, 7:54 PM
Goal
To provide full CRUD operations (
remove,splice, move) for theNeo.data.TreeStore, ensuring that the internal data maps (#childrenMap,#allRecordsMap) and the ARIA sibling stats remain perfectly synchronized with the visible flat array.Context
Currently, the
TreeStoresupports data ingestion (add) and visibility toggling (expand/collapse). However, invoking standard Collection mutation methods likeremoveorsplicewill only affect the visibleitemsarray, causing memory leaks and structural corruption in the internal Tree maps.This is a critical prerequisite for advanced TreeGrid features like Drag & Drop reordering and moving child nodes between parents.
Requirements
splice: Implement a customsplicemethod inTreeStorethat acts as the single source of truth for all mutations.#allRecordsMap.#childrenMap.super.splice().parentId.#childrenMap.#childrenMap.updateSiblingStats(parentId)on all affected parents to ensuresiblingCountandsiblingIndexremain accurate for O(1) rendering reads.