Skip to content

feat(experimental-tree): add ISharedTree interface and deprecate SharedTree class#26721

Open
tylerbutler wants to merge 5 commits intomainfrom
tylerbu/experimental-tree-deprecate
Open

feat(experimental-tree): add ISharedTree interface and deprecate SharedTree class#26721
tylerbutler wants to merge 5 commits intomainfrom
tylerbu/experimental-tree-deprecate

Conversation

@tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Mar 13, 2026

Summary

  • 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 ISharedTree
  • Update examples to use ISharedTree for type annotations instead of the deprecated class

This is a non-breaking change — no APIs are removed or modified. ISharedTree extends ISharedObject<ISharedTreeEvents> to maintain full compatibility with the existing type hierarchy.

This prepares for a follow-up breaking change (#26722) that will decouple ISharedTree from ISharedObject.

…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.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ISharedTree interface and marked SharedTree class as @deprecated.
  • Updated example apps/benchmarks/migration samples to use ISharedTree for type annotations.
  • Added targeted ESLint suppressions where deprecated SharedTree usage 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);
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.

2 participants