(snapshot: Snapshot, editIndex: number)
| 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); |
no test coverage detected