From b56b3dee373ef820bb1b7d229b9d3d546f42affa Mon Sep 17 00:00:00 2001 From: daesunp <138815173+daesunp@users.noreply.github.com> Date: Thu, 27 Nov 2025 22:06:26 +0000 Subject: [PATCH 1/3] Add label for transaction commits --- .../dds/tree/api-report/tree.alpha.api.md | 1 + .../src/shared-tree/schematizingTreeView.ts | 23 +- .../src/simple-tree/api/transactionTypes.ts | 5 + .../shared-tree/schematizingTreeView.spec.ts | 211 ++++++++++++++++++ .../api-report/fluid-framework.alpha.api.md | 1 + 5 files changed, 240 insertions(+), 1 deletion(-) diff --git a/packages/dds/tree/api-report/tree.alpha.api.md b/packages/dds/tree/api-report/tree.alpha.api.md index 0bfcbf3644a2..4135abdbb3ed 100644 --- a/packages/dds/tree/api-report/tree.alpha.api.md +++ b/packages/dds/tree/api-report/tree.alpha.api.md @@ -890,6 +890,7 @@ export interface RunTransaction { // @alpha @input export interface RunTransactionParams { + readonly label?: unknown; readonly preconditions?: readonly TransactionConstraint[]; } diff --git a/packages/dds/tree/src/shared-tree/schematizingTreeView.ts b/packages/dds/tree/src/shared-tree/schematizingTreeView.ts index b04d121ecb67..ca6cc00d0c06 100644 --- a/packages/dds/tree/src/shared-tree/schematizingTreeView.ts +++ b/packages/dds/tree/src/shared-tree/schematizingTreeView.ts @@ -87,6 +87,21 @@ export class SchematizingSimpleTreeView< in out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema, > implements TreeViewAlpha, WithBreakable { + /** + * Optional user-provided label associated with the transaction as a commit is being applied, if provided. + * This value is intended to be read within event handlers like `commitApplied`. + * This value is cleared after each transaction to prevent providing stale/incorrect labels. + */ + private static _currentTransactionLabel: unknown | undefined; + + public static get currentTransactionLabel(): unknown | undefined { + return this._currentTransactionLabel; + } + + public static setCurrentTransactionLabel(label: unknown | undefined): void { + this._currentTransactionLabel = label; + } + /** * This is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema. * @@ -319,7 +334,13 @@ export class SchematizingSimpleTreeView< transactionCallbackStatus?.preconditionsOnRevert, ); - this.checkout.transaction.commit(); + // Set the label before commit, and clear the label after commit. + SchematizingSimpleTreeView.setCurrentTransactionLabel(params?.label); + try { + this.checkout.transaction.commit(); + } finally { + SchematizingSimpleTreeView.setCurrentTransactionLabel(undefined); + } return value !== undefined ? { success: true, value: value as TSuccessValue } : { success: true }; diff --git a/packages/dds/tree/src/simple-tree/api/transactionTypes.ts b/packages/dds/tree/src/simple-tree/api/transactionTypes.ts index 757f0b3ddc56..9dd4320401dd 100644 --- a/packages/dds/tree/src/simple-tree/api/transactionTypes.ts +++ b/packages/dds/tree/src/simple-tree/api/transactionTypes.ts @@ -123,4 +123,9 @@ export interface RunTransactionParams { * this client and ignored by all other clients. */ readonly preconditions?: readonly TransactionConstraint[]; + /** + * An optional user-defined label for this transaction. + * This can be used for grouping logic for Undo/Redo operations. + */ + readonly label?: unknown; } diff --git a/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts b/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts index e44803e525f7..b316e2f53e7b 100644 --- a/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts +++ b/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts @@ -50,6 +50,7 @@ import { brand } from "../../util/index.js"; import { UnhydratedFlexTreeNode } from "../../simple-tree/core/unhydratedFlexTree.js"; import { testDocumentIndependentView } from "../testTrees.js"; import { fieldJsonCursor } from "../json/index.js"; +import { CommitKind } from "../../core/index.js"; const schema = new SchemaFactoryAlpha("com.example"); const config = new TreeViewConfiguration({ schema: schema.number }); @@ -1118,4 +1119,214 @@ describe("SchematizingSimpleTreeView", () => { }); }); }); + + describe("transaction labels", () => { + it("exposes label via currentTransactionLabel during commitApplied", () => { + const view = getTestObjectView(); + + const labels: unknown[] = []; + + view.events.on("commitApplied", (meta) => { + if (meta.isLocal) { + labels.push(SchematizingSimpleTreeView.currentTransactionLabel); + } + }); + + const testLabel = "testLabel"; + const runTransactionResult = view.runTransaction( + () => { + view.root.content = 0; + }, + { label: testLabel }, + ); + + // Check that transaction was applied. + assert.equal(runTransactionResult.success, true); + + // Check that correct label was exposed. + assert.deepEqual(labels, [testLabel]); + + // Check that transaction label has been cleared. + assert.equal(SchematizingSimpleTreeView.currentTransactionLabel, undefined); + }); + + it("currentTransactionLabel is undefined for unlabeled transactions", () => { + const view = getTestObjectView(); + + const labels: unknown[] = []; + + view.events.on("commitApplied", (meta) => { + if (meta.isLocal) { + labels.push(SchematizingSimpleTreeView.currentTransactionLabel); + } + }); + + const runTransactionResult = view.runTransaction(() => { + view.root.content = 0; + }); + + // Check that transaction was applied. + assert.equal(runTransactionResult.success, true); + assert.equal(view.root.content, 0); + + // Check that correct label was exposed. + assert.deepEqual(labels, [undefined]); + + // Check that transaction label has been cleared. + assert.equal(SchematizingSimpleTreeView.currentTransactionLabel, undefined); + }); + + it("exposes the correct labels for multiple transactions", () => { + const view = getTestObjectView(); + + const labels: unknown[] = []; + + view.events.on("commitApplied", (meta) => { + if (meta.isLocal) { + labels.push(SchematizingSimpleTreeView.currentTransactionLabel); + } + }); + + const testLabel1 = "testLabel1"; + const runTransactionResult1 = view.runTransaction( + () => { + view.root.content = 0; + }, + { label: testLabel1 }, + ); + + // run second transaction with no label + const runTransactionResult2 = view.runTransaction(() => { + view.root.content = 1; + }); + + const testLabel3 = "testLabel3"; + const runTransactionResult3 = view.runTransaction( + () => { + view.root.content = 2; + }, + { label: testLabel3 }, + ); + // Check that transactions were applied. + assert.equal(runTransactionResult1.success, true); + assert.equal(runTransactionResult2.success, true); + assert.equal(runTransactionResult3.success, true); + + // Check that correct label was exposed. + assert.deepEqual(labels, [testLabel1, undefined, testLabel3]); + + // Check that transaction label has been cleared. + assert.equal(SchematizingSimpleTreeView.currentTransactionLabel, undefined); + }); + }); + + describe("label-based grouping for undo", () => { + it("groups multiple transactions with the same label into a single undo group", () => { + const view = getTestObjectView(); + + interface LabeledGroup { + label: unknown; + revertibles: { revert(): void }[]; + } + + const undoGroups: LabeledGroup[] = []; + + view.events.on("commitApplied", (meta, getRevertible) => { + // Omit remote, Undo/Redo commits + if (meta.isLocal && getRevertible !== undefined && meta.kind === CommitKind.Default) { + const label = SchematizingSimpleTreeView.currentTransactionLabel; + const revertible = getRevertible(); + + // Check if the latest group contains the same label. + const latestGroup = undoGroups[undoGroups.length - 1]; + if ( + label !== undefined && + latestGroup !== undefined && + label === latestGroup.label + ) { + latestGroup.revertibles.push(revertible); + } else { + undoGroups.push({ label, revertibles: [revertible] }); + } + } + }); + + const undoLatestGroup = () => { + const latestGroup = undoGroups.pop() ?? fail("There are currently no undo groups."); + for (const revertible of latestGroup.revertibles.reverse()) { + revertible.revert(); + } + }; + + const initialRootContent = view.root.content; + + // Edit group 1 + const testLabel1 = "testLabel1"; + + const runTransactionResult1 = view.runTransaction( + () => { + view.root.content = 1; + }, + { label: testLabel1 }, + ); + assert.equal(runTransactionResult1.success, true); + assert.equal(view.root.content, 1); + + const runTransactionResult2 = view.runTransaction( + () => { + view.root.content = 2; + }, + { label: testLabel1 }, + ); + assert.equal(runTransactionResult2.success, true); + assert.equal(view.root.content, 2); + + const runTransactionResult3 = view.runTransaction( + () => { + view.root.content = 3; + }, + { label: testLabel1 }, + ); + assert.equal(runTransactionResult3.success, true); + assert.equal(view.root.content, 3); + + // Edit group 2 + const testLabel2 = "testLabel2"; + + const runTransactionResult4 = view.runTransaction( + () => { + view.root.content = 4; + }, + { label: testLabel2 }, + ); + assert.equal(runTransactionResult4.success, true); + assert.equal(view.root.content, 4); + + const runTransactionResult5 = view.runTransaction( + () => { + view.root.content = 5; + }, + { label: testLabel2 }, + ); + assert.equal(runTransactionResult5.success, true); + assert.equal(view.root.content, 5); + + const runTransactionResult6 = view.runTransaction( + () => { + view.root.content = 6; + }, + { label: testLabel2 }, + ); + assert.equal(runTransactionResult6.success, true); + assert.equal(view.root.content, 6); + + // This should undo all the edits from group 2. + undoLatestGroup(); + assert.equal(view.root.content, 3); + + // This should undo all the edits from group 1 + undoLatestGroup(); + assert.equal(view.root.content, initialRootContent); + }); + }); }); diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md index 26815b768243..081fe515a18b 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md @@ -1261,6 +1261,7 @@ export interface RunTransaction { // @alpha @input export interface RunTransactionParams { + readonly label?: unknown; readonly preconditions?: readonly TransactionConstraint[]; } From 43c539ff859d7989bb1c87ad7d4529ebb430d2af Mon Sep 17 00:00:00 2001 From: daesunp <138815173+daesunp@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:48:04 +0000 Subject: [PATCH 2/3] PR review --- packages/dds/tree/src/core/index.ts | 1 + packages/dds/tree/src/core/rebase/index.ts | 1 + packages/dds/tree/src/core/rebase/types.ts | 12 +++ .../src/shared-tree/schematizingTreeView.ts | 75 ++++++++----------- .../dds/tree/src/shared-tree/treeCheckout.ts | 33 +++++++- .../src/simple-tree/api/transactionTypes.ts | 5 +- packages/dds/tree/src/simple-tree/api/tree.ts | 8 +- .../shared-tree/schematizingTreeView.spec.ts | 21 ++---- 8 files changed, 89 insertions(+), 67 deletions(-) diff --git a/packages/dds/tree/src/core/index.ts b/packages/dds/tree/src/core/index.ts index b09aa7c6dd21..68aa987ff0ab 100644 --- a/packages/dds/tree/src/core/index.ts +++ b/packages/dds/tree/src/core/index.ts @@ -173,6 +173,7 @@ export { type GraphCommit, CommitKind, type CommitMetadata, + type CommitMetadataAlpha, type RevisionTag, RevisionTagSchema, RevisionTagCodec, diff --git a/packages/dds/tree/src/core/rebase/index.ts b/packages/dds/tree/src/core/rebase/index.ts index 5955a3f087c8..67fd91e3eecc 100644 --- a/packages/dds/tree/src/core/rebase/index.ts +++ b/packages/dds/tree/src/core/rebase/index.ts @@ -12,6 +12,7 @@ export { type GraphCommit, CommitKind, type CommitMetadata, + type CommitMetadataAlpha, type RevisionTag, RevisionTagSchema, type EncodedRevisionTag, diff --git a/packages/dds/tree/src/core/rebase/types.ts b/packages/dds/tree/src/core/rebase/types.ts index 0ec05e74b27b..2adf0eddb423 100644 --- a/packages/dds/tree/src/core/rebase/types.ts +++ b/packages/dds/tree/src/core/rebase/types.ts @@ -183,6 +183,18 @@ export interface CommitMetadata { readonly isLocal: boolean; } +/** + * Extended commit metadata that includes an optional user-provided label. + * @alpha + */ +export interface CommitMetadataAlpha extends CommitMetadata { + /** + * Optional label provided by the user when commit was created. + * This can be used by undo/redo to group or classify edits. + */ + label?: unknown; +} + /** * Creates a new graph commit object. This is useful for creating copies of commits with different parentage. * @param parent - the parent of the new commit diff --git a/packages/dds/tree/src/shared-tree/schematizingTreeView.ts b/packages/dds/tree/src/shared-tree/schematizingTreeView.ts index ca6cc00d0c06..f3729ad0f2cd 100644 --- a/packages/dds/tree/src/shared-tree/schematizingTreeView.ts +++ b/packages/dds/tree/src/shared-tree/schematizingTreeView.ts @@ -87,21 +87,6 @@ export class SchematizingSimpleTreeView< in out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema, > implements TreeViewAlpha, WithBreakable { - /** - * Optional user-provided label associated with the transaction as a commit is being applied, if provided. - * This value is intended to be read within event handlers like `commitApplied`. - * This value is cleared after each transaction to prevent providing stale/incorrect labels. - */ - private static _currentTransactionLabel: unknown | undefined; - - public static get currentTransactionLabel(): unknown | undefined { - return this._currentTransactionLabel; - } - - public static setCurrentTransactionLabel(label: unknown | undefined): void { - this._currentTransactionLabel = label; - } - /** * This is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema. * @@ -311,39 +296,43 @@ export class SchematizingSimpleTreeView< addConstraintsToTransaction(this.checkout, constraintsOnRevert, constraints); }; - this.checkout.transaction.start(); - - // Validate preconditions before running the transaction callback. - addConstraints(false /* constraintsOnRevert */, params?.preconditions); - const transactionCallbackStatus = transaction(); - const rollback = transactionCallbackStatus?.rollback; - const value = ( - transactionCallbackStatus as TransactionCallbackStatus - )?.value; + const executeTransaction = (): + | TransactionResultExt + | TransactionResult => { + this.checkout.transaction.start(); - if (rollback === true) { - this.checkout.transaction.abort(); - return value !== undefined - ? { success: false, value: value as TFailureValue } - : { success: false }; - } + // Validate preconditions before running the transaction callback. + addConstraints(false /* constraintsOnRevert */, params?.preconditions); + const transactionCallbackStatus = transaction(); + const rollback = transactionCallbackStatus?.rollback; + const value = ( + transactionCallbackStatus as TransactionCallbackStatus + )?.value; + + if (rollback === true) { + this.checkout.transaction.abort(); + return value !== undefined + ? { success: false, value: value as TFailureValue } + : { success: false }; + } - // Validate preconditions on revert after running the transaction callback and was successful. - addConstraints( - true /* constraintsOnRevert */, - transactionCallbackStatus?.preconditionsOnRevert, - ); + // Validate preconditions on revert after running the transaction callback and was successful. + addConstraints( + true /* constraintsOnRevert */, + transactionCallbackStatus?.preconditionsOnRevert, + ); - // Set the label before commit, and clear the label after commit. - SchematizingSimpleTreeView.setCurrentTransactionLabel(params?.label); - try { this.checkout.transaction.commit(); - } finally { - SchematizingSimpleTreeView.setCurrentTransactionLabel(undefined); + + return value !== undefined + ? { success: true, value: value as TSuccessValue } + : { success: true }; + }; + + if (params?.label !== undefined) { + return this.checkout.runWithTransactionLabel(params.label, () => executeTransaction()); } - return value !== undefined - ? { success: true, value: value as TSuccessValue } - : { success: true }; + return executeTransaction(); } private ensureUndisposed(): void { diff --git a/packages/dds/tree/src/shared-tree/treeCheckout.ts b/packages/dds/tree/src/shared-tree/treeCheckout.ts index 3ee3fa907f82..666ab6b82954 100644 --- a/packages/dds/tree/src/shared-tree/treeCheckout.ts +++ b/packages/dds/tree/src/shared-tree/treeCheckout.ts @@ -20,7 +20,6 @@ import { type AnchorSetRootEvents, type ChangeFamily, CommitKind, - type CommitMetadata, type DeltaVisitor, type DetachedFieldIndex, type IEditableForest, @@ -48,6 +47,7 @@ import { type TreeNodeStoredSchema, LeafNodeStoredSchema, diffHistories, + type CommitMetadataAlpha, } from "../core/index.js"; import { type FieldBatchCodec, @@ -122,7 +122,7 @@ export interface CheckoutEvents { * @param getRevertible - a function provided that allows users to get a revertible for the change. If not provided, * this change is not revertible. */ - changed(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void; + changed(data: CommitMetadataAlpha, getRevertible?: RevertibleAlphaFactory): void; /** * Fired when a new branch is created from this checkout. @@ -370,6 +370,9 @@ export class TreeCheckout implements ITreeCheckoutFork { private editLock: EditLock; + // User-defined label associated with the transaction whose commit is currently being produced for this checkout. + public transactionLabel?: unknown; + private readonly views = new Set>(); /** @@ -421,6 +424,18 @@ export class TreeCheckout implements ITreeCheckoutFork { this.registerForBranchEvents(); } + public runWithTransactionLabel( + label: TLabel, + fn: (label: TLabel) => TResult, + ): TResult { + this.transactionLabel = label; + try { + return fn(label); + } finally { + this.transactionLabel = undefined; + } + } + private registerForBranchEvents(): void { this.#transaction.branch.events.on("afterChange", this.onAfterBranchChange); this.#transaction.activeBranchEvents.on("afterChange", this.onAfterChange); @@ -532,12 +547,22 @@ export class TreeCheckout implements ITreeCheckoutFork { }; let withinEventContext = true; - this.#events.emit("changed", { isLocal: true, kind }, getRevertible); + const metaData: CommitMetadataAlpha = { + isLocal: true, + kind, + label: this.transactionLabel, + }; + this.#events.emit("changed", metaData, getRevertible); withinEventContext = false; } } else if (this.isRemoteChangeEvent(event)) { // TODO: figure out how to plumb through commit kind info for remote changes - this.#events.emit("changed", { isLocal: false, kind: CommitKind.Default }); + const metaData: CommitMetadataAlpha = { + isLocal: false, + kind: CommitKind.Default, + label: this.transactionLabel, + }; + this.#events.emit("changed", metaData); } }; diff --git a/packages/dds/tree/src/simple-tree/api/transactionTypes.ts b/packages/dds/tree/src/simple-tree/api/transactionTypes.ts index 9dd4320401dd..2b11594bc47b 100644 --- a/packages/dds/tree/src/simple-tree/api/transactionTypes.ts +++ b/packages/dds/tree/src/simple-tree/api/transactionTypes.ts @@ -125,7 +125,10 @@ export interface RunTransactionParams { readonly preconditions?: readonly TransactionConstraint[]; /** * An optional user-defined label for this transaction. - * This can be used for grouping logic for Undo/Redo operations. + * + * This label is associated with the commit produced by this transaction, and is surfaced through {@link CommitMetadataAlpha.label}, + * in the `commitApplied` event. + * */ readonly label?: unknown; } diff --git a/packages/dds/tree/src/simple-tree/api/tree.ts b/packages/dds/tree/src/simple-tree/api/tree.ts index 05bc303083af..514b5ccd90c1 100644 --- a/packages/dds/tree/src/simple-tree/api/tree.ts +++ b/packages/dds/tree/src/simple-tree/api/tree.ts @@ -6,7 +6,7 @@ import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/core-interfaces"; import type { - CommitMetadata, + CommitMetadataAlpha, RevertibleAlphaFactory, RevertibleFactory, } from "../../core/index.js"; @@ -508,7 +508,7 @@ export interface TreeBranchEvents extends Omit * @param getRevertible - a function that allows users to get a revertible for the change. If not provided, * this change is not revertible. */ - changed(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void; + changed(data: CommitMetadataAlpha, getRevertible?: RevertibleAlphaFactory): void; /** * Fired when: @@ -527,7 +527,7 @@ export interface TreeBranchEvents extends Omit * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided, * this commit is not revertible. */ - commitApplied(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void; + commitApplied(data: CommitMetadataAlpha, getRevertible?: RevertibleAlphaFactory): void; } /** @@ -571,7 +571,7 @@ export interface TreeViewEvents { * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided, * this commit is not revertible. */ - commitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void; + commitApplied(data: CommitMetadataAlpha, getRevertible?: RevertibleFactory): void; } /** diff --git a/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts b/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts index b316e2f53e7b..78f37ec5384e 100644 --- a/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts +++ b/packages/dds/tree/src/test/shared-tree/schematizingTreeView.spec.ts @@ -1121,14 +1121,14 @@ describe("SchematizingSimpleTreeView", () => { }); describe("transaction labels", () => { - it("exposes label via currentTransactionLabel during commitApplied", () => { + it("exposes label via CommitMetadataAlpha during commitApplied", () => { const view = getTestObjectView(); const labels: unknown[] = []; view.events.on("commitApplied", (meta) => { if (meta.isLocal) { - labels.push(SchematizingSimpleTreeView.currentTransactionLabel); + labels.push(meta.label); } }); @@ -1145,19 +1145,16 @@ describe("SchematizingSimpleTreeView", () => { // Check that correct label was exposed. assert.deepEqual(labels, [testLabel]); - - // Check that transaction label has been cleared. - assert.equal(SchematizingSimpleTreeView.currentTransactionLabel, undefined); }); - it("currentTransactionLabel is undefined for unlabeled transactions", () => { + it("CommitMetadataAlpha.label is undefined for unlabeled transactions", () => { const view = getTestObjectView(); const labels: unknown[] = []; view.events.on("commitApplied", (meta) => { if (meta.isLocal) { - labels.push(SchematizingSimpleTreeView.currentTransactionLabel); + labels.push(meta.label); } }); @@ -1171,9 +1168,6 @@ describe("SchematizingSimpleTreeView", () => { // Check that correct label was exposed. assert.deepEqual(labels, [undefined]); - - // Check that transaction label has been cleared. - assert.equal(SchematizingSimpleTreeView.currentTransactionLabel, undefined); }); it("exposes the correct labels for multiple transactions", () => { @@ -1183,7 +1177,7 @@ describe("SchematizingSimpleTreeView", () => { view.events.on("commitApplied", (meta) => { if (meta.isLocal) { - labels.push(SchematizingSimpleTreeView.currentTransactionLabel); + labels.push(meta.label); } }); @@ -1214,9 +1208,6 @@ describe("SchematizingSimpleTreeView", () => { // Check that correct label was exposed. assert.deepEqual(labels, [testLabel1, undefined, testLabel3]); - - // Check that transaction label has been cleared. - assert.equal(SchematizingSimpleTreeView.currentTransactionLabel, undefined); }); }); @@ -1234,7 +1225,7 @@ describe("SchematizingSimpleTreeView", () => { view.events.on("commitApplied", (meta, getRevertible) => { // Omit remote, Undo/Redo commits if (meta.isLocal && getRevertible !== undefined && meta.kind === CommitKind.Default) { - const label = SchematizingSimpleTreeView.currentTransactionLabel; + const label = meta.label; const revertible = getRevertible(); // Check if the latest group contains the same label. From 9b860f3ab18497a2f9e09085f72fb8636489ddcf Mon Sep 17 00:00:00 2001 From: daesunp <138815173+daesunp@users.noreply.github.com> Date: Wed, 17 Dec 2025 16:39:03 +0000 Subject: [PATCH 3/3] fix after merge --- packages/dds/tree/src/shared-tree/treeCheckout.ts | 6 +++--- packages/dds/tree/src/simple-tree/api/tree.ts | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/dds/tree/src/shared-tree/treeCheckout.ts b/packages/dds/tree/src/shared-tree/treeCheckout.ts index 27eaf30b9195..020bb62a682a 100644 --- a/packages/dds/tree/src/shared-tree/treeCheckout.ts +++ b/packages/dds/tree/src/shared-tree/treeCheckout.ts @@ -560,7 +560,7 @@ export class TreeCheckout implements ITreeCheckoutFork { }; let withinEventContext = true; - + const metadata: ChangeMetadata = { kind, isLocal: true, @@ -593,10 +593,10 @@ export class TreeCheckout implements ITreeCheckoutFork { } } else if (this.isRemoteChangeEvent(event)) { // TODO: figure out how to plumb through commit kind info for remote changes - const metaData: CommitMetadataAlpha = { + const metaData: ChangeMetadata = { isLocal: false, kind: CommitKind.Default, - label: this.transactionLabel, + label: undefined, }; this.#events.emit("changed", metaData); } diff --git a/packages/dds/tree/src/simple-tree/api/tree.ts b/packages/dds/tree/src/simple-tree/api/tree.ts index 0cb3ff7b731b..b4aa48b49770 100644 --- a/packages/dds/tree/src/simple-tree/api/tree.ts +++ b/packages/dds/tree/src/simple-tree/api/tree.ts @@ -6,7 +6,6 @@ import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/core-interfaces"; import type { - CommitMetadata, ChangeMetadata, RevertibleAlphaFactory, RevertibleFactory, @@ -542,7 +541,7 @@ export interface TreeBranchEvents extends Omit * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided, * this commit is not revertible. */ - commitApplied(data: CommitMetadataAlpha, getRevertible?: RevertibleAlphaFactory): void; + commitApplied(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void; } /** @@ -586,7 +585,7 @@ export interface TreeViewEvents { * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided, * this commit is not revertible. */ - commitApplied(data: CommitMetadataAlpha, getRevertible?: RevertibleFactory): void; + commitApplied(data: ChangeMetadata, getRevertible?: RevertibleFactory): void; } /**