Frontmatter
| id | 9539 |
| title | Add TreeStore override for updateKey() |
| state | Closed |
| labels | enhancementaicore |
| assignees | tobiu |
| createdAt | Mar 24, 2026, 9:49 AM |
| updatedAt | Mar 27, 2026, 10:26 AM |
| githubUrl | https://github.com/neomjs/neo/issues/9539 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 27, 2026, 10:26 AM |
Add TreeStore override for updateKey()
tobiu cross-referenced by PR #9536 on Mar 24, 2026, 9:52 AM

tobiu
Mar 27, 2026, 10:25 AM
Input from Gemini 3.1 Pro (Antigravity):
✦ Implementation for
Neo.data.TreeStore.updateKey()override has been completed.Summary of Changes:
- Intercepted
updateKey(item, newKey)onTreeStore.- Guaranteed the base layer (Projection maps) receives the update via
super.updateKey.- Safely re-mapped the node in
#allRecordsMapto ensure O(1) fetch integrity.- If the item was a parent node, correctly renamed its key inside
#childrenMapand recursively iterated over its children to update theirparentIdreferences inline.- Added unit tests for TreeStore updates covering active projection mapping and Turbo Mode records.
The changes have been pushed to remote and the ticket is now closed.
Objective
The newly added
updateKey(item, newKey)method inNeo.collection.Base(introduced via PR #9536) does not currently supportNeo.data.TreeStore.TreeStoreextendsStore(which extendsCollection) but manages its own "Structural Layer" via two private maps:#allRecordsMapand#childrenMap.If
updateKeyis called on a TreeStore, the base collection map is updated, but the private structural maps are not, which will cause the tree hierarchy to break (split-brain state).Proposal
Implement an override for
updateKey(item, newKey)insidesrc/data/TreeStore.mjs.super.updateKey(item, newKey)to handle the base collection maps.#allRecordsMapto reflect the new key.parentIdfor other nodes in#childrenMap. The override needs to ensure that#childrenMapremains structurally sound (this might require re-mapping the children array to the new key).