feat(experimental-tree): add ISharedTree interface and deprecate SharedTree class#26721
Open
tylerbutler wants to merge 5 commits intomainfrom
Open
feat(experimental-tree): add ISharedTree interface and deprecate SharedTree class#26721tylerbutler wants to merge 5 commits intomainfrom
tylerbutler wants to merge 5 commits intomainfrom
Conversation
…edTree class Add a new ISharedTree interface extracted from the SharedTree class as the recommended type for referencing tree instances. Mark the SharedTree class as @deprecated, directing users to use ISharedTree instead. This is a non-breaking, additive change — no APIs are removed or modified. ISharedTree extends ISharedObject<ISharedTreeEvents> to maintain full compatibility with the existing type hierarchy.
Update example code to use ISharedTree for type annotations instead of the deprecated SharedTree class. Add eslint-disable comments for intentional value usages (static methods like create/getFactory). Affected examples: - bubblebench/experimental-tree - tree-comparison - bundle-size-tests
Update version-migration/tree-shim example to use ISharedTree for type annotations instead of the deprecated SharedTree class. Add eslint-disable comments for intentional value usages.
SharedTreeFactory requires a writeFormat argument. Use WriteFormat.v0_1_1 to match the previous getFactory() default behavior.
This was referenced Mar 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new ISharedTree interface in @fluid-experimental/tree to be the recommended type for referencing tree instances, while deprecating direct usage of the SharedTree class and updating examples to annotate with the interface instead of the class.
Changes:
- Added new exported
ISharedTreeinterface and markedSharedTreeclass as@deprecated. - Updated example apps/benchmarks/migration samples to use
ISharedTreefor type annotations. - Added targeted ESLint suppressions where deprecated
SharedTreeusage remains necessary (e.g., factories and bundle-size tests).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| experimental/dds/tree/src/index.ts | Re-export ISharedTree from the package entrypoint. |
| experimental/dds/tree/src/SharedTree.ts | Deprecates SharedTree via TSDoc. |
| experimental/dds/tree/src/ISharedTree.ts | Introduces the new ISharedTree interface definition. |
| examples/version-migration/tree-shim/src/model/legacyTreeInventoryListController.ts | Switches annotations to ISharedTree; uses casts where EagerCheckout still requires SharedTree. |
| examples/version-migration/tree-shim/src/model/inventoryList.ts | Updates migration shim typing to use ISharedTree and adjusts legacy factory construction. |
| examples/utils/bundle-size-tests/src/experimentalSharedTree.ts | Documents intentional deprecated SharedTree usage for bundle-size coverage. |
| examples/benchmarks/bubblebench/experimental-tree/src/state.ts | Updates app state to type trees as ISharedTree. |
| examples/benchmarks/bubblebench/experimental-tree/src/proxy/tree.ts | Updates proxy helpers to accept ISharedTree. |
| examples/benchmarks/bubblebench/experimental-tree/src/main.tsx | Updates stored handle/fields to ISharedTree while still constructing via deprecated SharedTree. |
| examples/apps/tree-comparison/src/model/legacyTreeInventoryList.ts | Updates annotations to ISharedTree; retains deprecated casts for EagerCheckout. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+387
to
+388
| * @deprecated Direct usage of the SharedTree class is deprecated. Use the {@link ISharedTree} interface | ||
| * to reference tree instances instead. The class will be removed from the public API surface in a future release. |
| ISharedTreeEvents, | ||
| StashedLocalOpMetadata, | ||
| } from './SharedTree.js'; | ||
| export type { ISharedTree } from './ISharedTree.js'; |
Comment on lines
+82
to
+86
| mergeEditsFrom( | ||
| other: ISharedTree, | ||
| edits: Iterable<Edit<InternalizedChange>>, | ||
| stableIdRemapper?: (id: StableNodeId) => StableNodeId | ||
| ): EditId[]; |
Comment on lines
+111
to
+112
| equals(sharedTree: ISharedTree): boolean; | ||
|
|
Comment on lines
+134
to
+135
| // eslint-disable-next-line import-x/no-deprecated | ||
| const checkout = new EagerCheckout(this._tree as LegacySharedTree); |
Comment on lines
+199
to
+200
| // eslint-disable-next-line import-x/no-deprecated | ||
| const checkout = new EagerCheckout(this._tree as LegacySharedTree); |
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.
Summary
ISharedTreeinterface extracted from theSharedTreeclass as the recommended type for referencing tree instancesSharedTreeclass as@deprecated, directing users toISharedTreeISharedTreefor type annotations instead of the deprecated classThis is a non-breaking change — no APIs are removed or modified.
ISharedTreeextendsISharedObject<ISharedTreeEvents>to maintain full compatibility with the existing type hierarchy.This prepares for a follow-up breaking change (#26722) that will decouple
ISharedTreefromISharedObject.