MCPcopy
hub / github.com/midrender/revideo / snapshotClone

Method snapshotClone

packages/2d/src/lib/components/Node.ts:1229–1240  ·  view source on GitHub ↗

* Create a copy of this node. * * @remarks * Unlike clone, a snapshot clone calculates any reactive properties * at the moment of cloning and passes the raw values to the copy. * * @param customProps - Properties to override.

(customProps: NodeState = {})

Source from the content-addressed store, hash-verified

1227 * @param customProps - Properties to override.
1228 */
1229 public snapshotClone(customProps: NodeState = {}): this {
1230 const props = {
1231 ...this.getState(),
1232 ...customProps,
1233 };
1234
1235 if (this.children().length > 0) {
1236 props.children ??= this.children().map(child => child.snapshotClone());
1237 }
1238
1239 return this.instantiate(props);
1240 }
1241
1242 /**
1243 * Create a reactive copy of this node.

Callers 1

clone.test.tsxFile · 0.80

Calls 2

getStateMethod · 0.95
instantiateMethod · 0.95

Tested by

no test coverage detected