-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(devtools-core): Render ST's Visualizer to Include Root Field's Allowed Types #23573
base: main
Are you sure you want to change the base?
feat(devtools-core): Render ST's Visualizer to Include Root Field's Allowed Types #23573
Conversation
This reverts commit fd50e40.
packages/tools/devtools/devtools-core/src/test/DefaultVisualizers.spec.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/test/DefaultVisualizers.spec.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/SharedTreeVisualizer.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/SharedTreeVisualizer.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/SharedTreeVisualizer.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/SharedTreeVisualizer.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/SharedTreeVisualizer.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/VisualSharedTreeTypes.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/VisualSharedTreeTypes.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a handful more comments, but overall this is looking really great! I suspect it will be ready for approval after you address these few comment.
…efaultVisualizers.ts Co-authored-by: Joshua Smithrud <[email protected]>
…haredTreeVisualizer.ts Co-authored-by: Joshua Smithrud <[email protected]>
…haredTreeVisualizer.ts Co-authored-by: Joshua Smithrud <[email protected]>
treeSchema: SimpleTreeSchema, | ||
treeFields: readonly VerboseTree[] | Record<string, VerboseTree>, | ||
treeDefinitions: ReadonlyMap<string, SimpleNodeSchema>, | ||
allowedTypes: Record<string, ReadonlySet<string>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike coupling the allowedTypes
and isRequired
in visualizeSharedTreeBySchema()
, I decided to leave these two parameters separately, since it isn't the entry point for the ST visualizer and I thought the doc describes when the requirements
can be undefined.
Interested in your thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you could combine the properties differently in this case, which might be a bit cleaner. E.g.,
fieldSchemaProperties: Record<string, FieldSchemaProperties>
Where you have a single record, instead of 2, that maps the field key to both of the relevant properties.
packages/tools/devtools/devtools-core/src/data-visualization/VisualSharedTreeTypes.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
packages/tools/devtools/devtools-core/src/data-visualization/DefaultVisualizers.ts
Outdated
Show resolved
Hide resolved
* Set of type names that are valid for this specific node position in the tree. | ||
* This is a subset of the types defined in treeDefinitions. | ||
*/ | ||
allowedTypes?: ReadonlySet<string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the properties here need to be optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted it to align with the optionality of VisualSharedTreeTypes.ts
(SharedTreeSchemaNode
). Hence, marked it optional since non-ST VisualNodes do not need allowed types at the moment.
packages/tools/devtools/devtools-core/src/data-visualization/SharedTreeVisualizer.ts
Outdated
Show resolved
Hide resolved
…isualSharedTreeTypes.ts Co-authored-by: Alex Villarreal <[email protected]>
…efaultVisualizers.ts Co-authored-by: Alex Villarreal <[email protected]>
…haredTreeVisualizer.ts Co-authored-by: Alex Villarreal <[email protected]>
…jikim-msft/FluidFramework into devtools/shared-tree-visualizer
Description
26472
The current visualization generation logic in
DefaultVisualizers.ts
treats the root of the shared tree as a node and thus omits information that should be included in the root of the ST visualizer. Since the root field is allowed to have multiple types (i.e., different schema or primitive types), this information should be rendered in the tooltip of the visualizer.This PR changes how the visualizer renders the allowed types in the tooltip
Example Schema
Before
![Screenshot 2025-01-15 at 16 38 24](https://private-user-images.githubusercontent.com/111468570/403628022-e7ec3151-a93c-484e-8cd2-4bb87a014a1f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNjg4NzEsIm5iZiI6MTczOTA2ODU3MSwicGF0aCI6Ii8xMTE0Njg1NzAvNDAzNjI4MDIyLWU3ZWMzMTUxLWE5M2MtNDg0ZS04Y2QyLTRiYjg3YTAxNGExZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwMjM2MTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NWMxZTBhMzZhNzdjOWYxZTQ2ZWRhOTNjM2Q5NTY3NjA1OGYwNjA0ZTlhOWQwZjQ5YWY3ZGFlYTQ2YjgwNTQxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.sjhsW1gvqRyjTyuoS4TnA9K0wTaxrNz6brJzQMcR2TQ)
After
![Screenshot 2025-01-29 at 19 48 01](https://private-user-images.githubusercontent.com/111468570/407986859-ec88bdbe-9160-48e1-8b42-754932bcfa47.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNjg4NzEsIm5iZiI6MTczOTA2ODU3MSwicGF0aCI6Ii8xMTE0Njg1NzAvNDA3OTg2ODU5LWVjODhiZGJlLTkxNjAtNDhlMS04YjQyLTc1NDkzMmJjZmE0Ny5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwMjM2MTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wZDBhNzlhMzhlODc3NWEzZmUxZWVmODI5MzUwMGJkMmFkZjRiN2YyMzNhMGM1YzM0MzY5MTY1YjUwYjQ1OTBhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.OWReJipovYxPsefrksvcEF1aJgvIHgivsUuJ7nMBPAI)
Defined
Undefined
![Screenshot 2025-01-29 at 19 43 32](https://private-user-images.githubusercontent.com/111468570/407986864-5ddfe67f-2af3-4550-95b7-b4075a903c0f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNjg4NzEsIm5iZiI6MTczOTA2ODU3MSwicGF0aCI6Ii8xMTE0Njg1NzAvNDA3OTg2ODY0LTVkZGZlNjdmLTJhZjMtNDU1MC05NWI3LWI0MDc1YTkwM2MwZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwMjM2MTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wZTU4ZmU2OWRkYTFkMWRhMDI4ZTY4MDU5NjdkMzUzZGE5YmQ3MjQzNTk5OTAwOWZjOThhNmJkNmE2YWU0MGNlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.9T0VVk4hzwsl-3Eduk7D8RD0WDtpNMS-_Ex1gvghdcc)