EditableTree: move EditableTreeContext code to a separate file#12300
Merged
CraigMacomber merged 1 commit intoOct 6, 2022
Merged
Conversation
CraigMacomber
approved these changes
Oct 6, 2022
Contributor
|
This commit is queued for merging with the |
CraigMacomber
pushed a commit
that referenced
this pull request
Oct 11, 2022
CraigMacomber
pushed a commit
that referenced
this pull request
Oct 14, 2022
This PR provide a way to access fields of EditableTree without
unwrapping. Currently, this works only on "all or nothing" basis meaning
that (given we got an instance of EditableTreeContext with
`getEditableTreeContext()`):
- one can call `context.unwrappedRoot` to get root of EditableTree with
all children fields unwrapped into just values of their nodes if those
are primitives and the field has a non-sequence schema, nodes with a
sequence primary field ("arrays") unwrapped into arrays and so on.
- and one can call `context.root` to get root field typed as
`EditableField`, where no unwrapping happens, and then iterate over its
nodes, which is just an array of EditableTrees.
In turn, one can iterate over `EditableTree` to get its fields as
EditableFields.
Please, check the `"traverse a complete tree (generic)"` test case and
the corresponding `expectFieldEquals` and `expectNodeEquals` helper
functions to see how this works.
Opinions, comments, suggestions are very welcomed.
**Step 3** in a series to push code from #12182 to enable editing of
EditableTree.
[Step 2](#12306)
[Step 1](#12300)
This was referenced Oct 14, 2022
Closed
CraigMacomber
added a commit
that referenced
this pull request
Oct 27, 2022
Same as [#12488](#12512), but using a new cursor API. ## Description This PR implements `EditableField` as an array-like sequence of nodes (`EditableTrees`), which 1) replaces handling of sequence fields with arrays, 2) allows to access nodes lazily by their indices with and without unwrapping, and 3) is a required change to implement editing of `EditableTree`. ## Reviewer Guidance Everything around "root" probably might be considered as a workaround as currently `cursor.getPath()` and anchors do not support fields. Also, it seems that "primaryField" property of `FieldProxyTarget` is redundant, as `fieldKey` is also there, but it adds clarity, and we might make use of it when implementing editing. ## Other information or known dependencies **Step 4** in a series to push code from #12182 to enable editing of EditableTree. [Step 3](#12428) [Step 2](#12306) [Step 1](#12300) Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
sharptrip
added a commit
to sharptrip/FluidFramework
that referenced
this pull request
Oct 28, 2022
) Same as [microsoft#12488](microsoft#12512), but using a new cursor API. ## Description This PR implements `EditableField` as an array-like sequence of nodes (`EditableTrees`), which 1) replaces handling of sequence fields with arrays, 2) allows to access nodes lazily by their indices with and without unwrapping, and 3) is a required change to implement editing of `EditableTree`. ## Reviewer Guidance Everything around "root" probably might be considered as a workaround as currently `cursor.getPath()` and anchors do not support fields. Also, it seems that "primaryField" property of `FieldProxyTarget` is redundant, as `fieldKey` is also there, but it adds clarity, and we might make use of it when implementing editing. ## Other information or known dependencies **Step 4** in a series to push code from microsoft#12182 to enable editing of EditableTree. [Step 3](microsoft#12428) [Step 2](microsoft#12306) [Step 1](microsoft#12300) Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
alexvy86
pushed a commit
to alexvy86/FluidFramework
that referenced
this pull request
Nov 1, 2022
) Same as [microsoft#12488](microsoft#12512), but using a new cursor API. ## Description This PR implements `EditableField` as an array-like sequence of nodes (`EditableTrees`), which 1) replaces handling of sequence fields with arrays, 2) allows to access nodes lazily by their indices with and without unwrapping, and 3) is a required change to implement editing of `EditableTree`. ## Reviewer Guidance Everything around "root" probably might be considered as a workaround as currently `cursor.getPath()` and anchors do not support fields. Also, it seems that "primaryField" property of `FieldProxyTarget` is redundant, as `fieldKey` is also there, but it adds clarity, and we might make use of it when implementing editing. ## Other information or known dependencies **Step 4** in a series to push code from microsoft#12182 to enable editing of EditableTree. [Step 3](microsoft#12428) [Step 2](microsoft#12306) [Step 1](microsoft#12300) Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a pure refactoring.
Step 1 in a series to push code from #12182.
Step 2 support global fields sharptrip#5
Step 3 support sequences (read-only)
Step 4 support editing
Step 5 add TypedJsonCursor and limited json support