Context
Measured on dev a07f581f13 with a throwaway unit spec. A TreeStore in Turbo Mode (autoInitRecords: false) whose model keys records by an Integer id:
data: [
{id: 1, name: 'a', parentId: null, isLeaf: false, collapsed: true},
{id: 2, name: 'a1', parentId: 1, isLeaf: true}
]
| Read |
Numeric ids (1, 2) |
String ids ('p', 'c'), control |
getChildren(parent)[0] === getChildren(parent)[0] |
false |
true |
get(child) === getChildren(parent)[0] |
false |
true |
first.name = 'edited', then get(child).name |
'a1' (the edit is lost) |
'edited' |
after await expand(parent), the visible row for the child |
the raw object, name: 'a1' |
the same record, name: 'edited' |
Numeric keys are what most server data carries (database ids), and Turbo Mode is the store's documented strategy for large data sets (src/data/Store.mjs, the class JSDoc).
The Problem
In Turbo Mode a raw row becomes a record the first time it is read (hydrateRecord). The TreeStore must then swap that record into its Structural Layer, or the next read hydrates the same raw object again into a second record. For the children of a numeric parent the swap never happens. Every getChildren() call returns a new record, an edit lives only on the record it was made on, and expanding the parent shows the raw row with the old values.
The Architectural Reality
- Ingestion files each raw row under its raw
parentId: parentId = data.parentId || 'root' in TreeStore#splice (src/data/TreeStore.mjs:1109), then #addChild(parentId, …) (:118). The children of parent 1 sit in #childrenMap under the number 1.
TreeModel declares parentId as a String field (src/data/TreeModel.mjs:53), so the hydrated record's parentId is the string '1'.
TreeStore#hydrateRecord (:877) heals the sibling list under record.parentId (:891). It looks up '1', finds no list, and leaves the raw object in place. getChildren() (:766) hydrates that raw object again on the next call.
Design authority: TreeStore#hydrateRecord's JSDoc, “This acts as the Single Source of Truth for "Soft Hydration" in Turbo Mode, ensuring that when a raw data object becomes a Record, the TreeStore doesn't suffer from a split-brain.”, and getChildren()'s, “Records are hydrated on the way out, so Turbo Mode (autoInitRecords: false) callers receive real records rather than the raw objects held in the map.”
The Fix
In TreeStore#hydrateRecord, look the siblings up under the key ingestion used, the raw row's own parentId:
const parentId = item.parentId || 'root';
instead of record.parentId || 'root' (:891). item is always the raw row there: the block only runs when item is not a record.
Measured with that one line on dev a07f581f13: the numeric case reads like the control in all four rows of the table above, and the six test/playwright/unit/data/TreeStore*.spec.mjs files stay green. Add the numeric case as a unit test beside them.
Run the unit tier with npm run test-unit -- test/playwright/unit/data/TreeStore (the default npx playwright test config is not the unit one).
Acceptance Criteria
Out of Scope
- A key field that converts the raw key itself (a raw
id: 1 under a String id field). There the record's own key differs from the key #allRecordsMap holds, which is a different path. Not measured here; file it separately if it reproduces.
- Raw data that mixes types (numeric
id, string parentId).
- Eager instantiation (
autoInitRecords: true, the default): not measured here.
Avoided Traps
- Converting
parentId at ingestion (filing children under String(parentId)). Every #childrenMap key would change, and every getChildren(1) caller would have to pass '1'. The one-line fix keeps the key the list was filed under.
- Changing
TreeModel's parentId field type. That changes the record's public parentId value for every consumer.
Related
#9415 (closed): Turbo Mode for the TreeStore, whose goal this restores, "without suffering from identity fragmentation between the main _items array and its internal tree maps" · #9404 (closed): the Tree Grid epic.
Live latest-open + closed sweep: the latest 20 open read (created descending) and closed searches (TreeStore parentId, TreeStore hydrateRecord, Turbo Mode getChildren, TreeStore numeric id; Out of Scope read on #20568, #9415's goal and #9539's body) at 2026-11-13T23:58Z; no equivalent and no exclusion of numeric keys. Backlog: 45 open (orange); no open ticket owns the TreeStore.
A2A in-flight claim sweep: the last 30 messages, all read states, at 2026-11-13T23:59Z; no claim on the TreeStore.
MC sweep: "TreeStore Turbo Mode numeric parent id: getChildren returns a new record every call, edits lost, hydrateRecord childrenMap not healed", 5 results: the March 2026 design of the healing (#9414, #9415), no decision about numeric keys.
Own-assignment sweep: 1 open (#20667, package hosting), not overlapping.
Structure map: N/A (Engine src/data, no file placed).
unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Origin Session ID: 236696c2-9277-40e4-969a-025bbcd2ce4c
Retrieval Hint: "TreeStore Turbo Mode numeric parentId hydrateRecord childrenMap split-brain getChildren new record"
Context
Measured on
deva07f581f13with a throwaway unit spec. ATreeStorein Turbo Mode (autoInitRecords: false) whose model keys records by anIntegerid:data: [ {id: 1, name: 'a', parentId: null, isLeaf: false, collapsed: true}, {id: 2, name: 'a1', parentId: 1, isLeaf: true} ]1,2)'p','c'), controlgetChildren(parent)[0] === getChildren(parent)[0]falsetrueget(child) === getChildren(parent)[0]falsetruefirst.name = 'edited', thenget(child).name'a1'(the edit is lost)'edited'await expand(parent), the visible row for the childname: 'a1'name: 'edited'Numeric keys are what most server data carries (database ids), and Turbo Mode is the store's documented strategy for large data sets (
src/data/Store.mjs, the class JSDoc).The Problem
In Turbo Mode a raw row becomes a record the first time it is read (
hydrateRecord). TheTreeStoremust then swap that record into its Structural Layer, or the next read hydrates the same raw object again into a second record. For the children of a numeric parent the swap never happens. EverygetChildren()call returns a new record, an edit lives only on the record it was made on, and expanding the parent shows the raw row with the old values.The Architectural Reality
parentId:parentId = data.parentId || 'root'inTreeStore#splice(src/data/TreeStore.mjs:1109), then#addChild(parentId, …)(:118). The children of parent1sit in#childrenMapunder the number1.TreeModeldeclaresparentIdas aStringfield (src/data/TreeModel.mjs:53), so the hydrated record'sparentIdis the string'1'.TreeStore#hydrateRecord(:877) heals the sibling list underrecord.parentId(:891). It looks up'1', finds no list, and leaves the raw object in place.getChildren()(:766) hydrates that raw object again on the next call.Design authority:
TreeStore#hydrateRecord's JSDoc, “This acts as the Single Source of Truth for "Soft Hydration" in Turbo Mode, ensuring that when a raw data object becomes a Record, the TreeStore doesn't suffer from a split-brain.”, andgetChildren()'s, “Records are hydrated on the way out, so Turbo Mode (autoInitRecords: false) callers receive real records rather than the raw objects held in the map.”The Fix
In
TreeStore#hydrateRecord, look the siblings up under the key ingestion used, the raw row's ownparentId:const parentId = item.parentId || 'root';instead of
record.parentId || 'root'(:891).itemis always the raw row there: the block only runs whenitemis not a record.Measured with that one line on
deva07f581f13: the numeric case reads like the control in all four rows of the table above, and the sixtest/playwright/unit/data/TreeStore*.spec.mjsfiles stay green. Add the numeric case as a unit test beside them.Run the unit tier with
npm run test-unit -- test/playwright/unit/data/TreeStore(the defaultnpx playwright testconfig is not the unit one).Acceptance Criteria
Integerkey field and numericparentIds,getChildren(parent)[0]returns the same record on every call, andget(child)returns that record (unit).get()andgetChildren(), and afterexpand(parent)the visible row is that record (unit).TreeStore*.spec.mjsfiles pass unchanged.Out of Scope
id: 1under aStringidfield). There the record's own key differs from the key#allRecordsMapholds, which is a different path. Not measured here; file it separately if it reproduces.id, stringparentId).autoInitRecords: true, the default): not measured here.Avoided Traps
parentIdat ingestion (filing children underString(parentId)). Every#childrenMapkey would change, and everygetChildren(1)caller would have to pass'1'. The one-line fix keeps the key the list was filed under.TreeModel'sparentIdfield type. That changes the record's publicparentIdvalue for every consumer.Related
#9415 (closed): Turbo Mode for the
TreeStore, whose goal this restores, "without suffering from identity fragmentation between the main_itemsarray and its internal tree maps" · #9404 (closed): the Tree Grid epic.Live latest-open + closed sweep: the latest 20 open read (created descending) and closed searches (
TreeStore parentId,TreeStore hydrateRecord,Turbo Mode getChildren,TreeStore numeric id; Out of Scope read on #20568, #9415's goal and #9539's body) at 2026-11-13T23:58Z; no equivalent and no exclusion of numeric keys. Backlog: 45 open (orange); no open ticket owns theTreeStore. A2A in-flight claim sweep: the last 30 messages, all read states, at 2026-11-13T23:59Z; no claim on theTreeStore. MC sweep: "TreeStore Turbo Mode numeric parent id: getChildren returns a new record every call, edits lost, hydrateRecord childrenMap not healed", 5 results: the March 2026 design of the healing (#9414, #9415), no decision about numeric keys. Own-assignment sweep: 1 open (#20667, package hosting), not overlapping. Structure map: N/A (Enginesrc/data, no file placed).unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Origin Session ID: 236696c2-9277-40e4-969a-025bbcd2ce4c Retrieval Hint: "TreeStore Turbo Mode numeric parentId hydrateRecord childrenMap split-brain getChildren new record"