Skip to main content

TreeChangeEventsBeta Interface

Extensions to TreeChangeEvents which are not yet stable.

This API is provided as a beta preview and may change without notice.

To use, import via @fluidframework/tree/beta.

For more information about our API support guarantees, see here.

Signature

/** @sealed */
export interface TreeChangeEventsBeta<TNode extends TreeNode = TreeNode> extends TreeChangeEvents

Extends: TreeChangeEvents

Type Parameters

Parameter Constraint Default Description
TNode TreeNode TreeNode

Properties

Property Alerts Type Description
nodeChanged Beta (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void

Emitted by a node after a batch of changes has been applied to the tree, if any of the changes affected the node.

- Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to undefined).

- Array nodes define a change as when an element is added, removed, moved or replaced.

- Map nodes define a change as when an entry is added, updated, or removed.

Property Details

nodeChanged

Emitted by a node after a batch of changes has been applied to the tree, if any of the changes affected the node.

  • Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to undefined).

  • Array nodes define a change as when an element is added, removed, moved or replaced.

  • Map nodes define a change as when an entry is added, updated, or removed.

This API is provided as a beta preview and may change without notice.

To use, import via @fluidframework/tree/beta.

For more information about our API support guarantees, see here.

Signature

nodeChanged: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void;

Type: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void

Remarks

This event is not emitted when:

  • Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing elements/entries) will emit this event on the array/map node itself, but not on the node that contains the array/map node as one of its properties.

  • The node is moved to a different location in the tree or removed from the tree. In this case the event is emitted on the _parent_ node, not the node itself.

For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in the client that made the original edit.

When the event is emitted, the tree is guaranteed to be in-schema.