Function: buildTreeState()
buildTreeState<
TRow>(data,config):TreeState<TRow>
Defined in: src/tree-editor/build-tree-state.ts:29
Converts the user’s data array plus a treeData config into a
TreeState.
- When
getChildrenis provided, the data is treated as nested and walked recursively. Children order is preserved. - When only
getParentIdis provided, the data is treated as flat, parent-pointer rows: root order and sibling order follow input order. - When neither accessor is provided, every row becomes a root.
The result is a fresh TreeState with no shared structure with the input — commands can safely mutate clones without leaking back to user data.
Type Parameters
TRow
TRow
Parameters
data
TRow[]
config
BuildTreeStateConfig<TRow>
Returns
TreeState<TRow>