MCPcopy Create free account
hub / github.com/microsoft/SandDance / writeSnapshot

Method writeSnapshot

packages/sanddance-explorer/src/explorer.tsx:949–964  ·  view source on GitHub ↗
(snapshot: Snapshot, editIndex: number)

Source from the content-addressed store, hash-verified

947 }
948
949 private writeSnapshot(snapshot: Snapshot, editIndex: number) {
950 let { selectedSnapshotIndex } = this.state;
951 let snapshots: Snapshot[];
952 if (editIndex >= 0) {
953 snapshots = [...this.state.snapshots];
954 snapshots[editIndex] = snapshot;
955 this.setState({ snapshots, selectedSnapshotIndex });
956 } else {
957 const note = snapshot.description;
958 snapshots = this.state.snapshots.concat(snapshot);
959 selectedSnapshotIndex = snapshots.length - 1;
960 this.scrollSnapshotIntoView(selectedSnapshotIndex);
961 this.setState({ sideTabId: SideTabId.Snapshots, snapshots, selectedSnapshotIndex, note });
962 }
963 this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots);
964 }
965
966 public scrollSnapshotIntoView(selectedSnapshotIndex: number) {
967 clearTimeout(this.scrollSnapshotTimer);

Callers 1

renderMethod · 0.95

Calls 1

Tested by

no test coverage detected