Skip to content

[PoC] Inspector for editable tree#20

Closed
sharptrip wants to merge 5 commits into
editable-tree-simple-assignmentsfrom
inspector-for-new-tree
Closed

[PoC] Inspector for editable tree#20
sharptrip wants to merge 5 commits into
editable-tree-simple-assignmentsfrom
inspector-for-new-tree

Conversation

@sharptrip
Copy link
Copy Markdown
Owner

@sharptrip sharptrip commented Dec 9, 2022

This PR contains the PoC implementation of the "property inspector" based on the new tree DDS and its EditableTree API.

The new inspector utilises the EditableTree API in a "full blown" manner operating with fields and nodes in a generic way when reading. A complete traverse of the tree could be "unchained" starting debugging from here:

return forEachNode(nodeToRows, rowData, [], "", addNewDataLine);

In contrast, the code also uses a not yet published "contextually typed API" and "simple assignments", which allows users to change data in a more convenient way:

const value = defaultPrimitiveValues[typeid];
if (isUnwrappedNode(rowData.parent)) {
(rowData.parent as ContextuallyTypedNodeDataObject)[brand<FieldKey>(name)] = {
[typeNameSymbol]: brand(typeid),
[valueSymbol]: value,
};
} else {
(rowData.parent as MarkedArrayLike<ContextuallyTypedNodeData>)[Number(name)] = {
[typeNameSymbol]: brand(typeid),
[valueSymbol]: value,
};
}

You can check the tests in the corresponding PR to get an idea of what it's all about: microsoft#13292

!Attention!

This EditableTree API change is not yet available (not even as a PR).

@sharptrip
Copy link
Copy Markdown
Owner Author

New version with transaction handling #22

@sharptrip sharptrip closed this Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant