Skip to content

[PoC] inspector for EditableTree with transaction handling#22

Draft
sharptrip wants to merge 9 commits into
mainfrom
editable-tree-inspector-with-transaction-handling
Draft

[PoC] inspector for EditableTree with transaction handling#22
sharptrip wants to merge 9 commits into
mainfrom
editable-tree-inspector-with-transaction-handling

Conversation

@sharptrip
Copy link
Copy Markdown
Owner

@sharptrip sharptrip commented Dec 16, 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!

Transaction handling and other features from commits related to the EditableTree API are not yet available (not even as a PR).

Upd.

Note the difference from original transaction handling PR, which is added by this commit

The reason: it seems that EditManager is not ready to support our case.

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