fix(trace-viewer): when clicking on a step no snapshot was shown (#8038)

This commit is contained in:
Max Schmitt 2021-08-06 16:13:05 +02:00 committed by GitHub
parent fcb8d5310a
commit 7ee92f3fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@ export const SnapshotTab: React.FunctionComponent<{
const snapshots = [actionSnapshot ? { ...actionSnapshot, title: 'action' } : undefined, snapshotMap.get('before'), snapshotMap.get('after')].filter(Boolean) as { title: string, snapshotName: string }[]; const snapshots = [actionSnapshot ? { ...actionSnapshot, title: 'action' } : undefined, snapshotMap.get('before'), snapshotMap.get('after')].filter(Boolean) as { title: string, snapshotName: string }[];
React.useEffect(() => { React.useEffect(() => {
if (snapshotIndex >= snapshots.length) if (snapshots.length >= 1 && snapshotIndex >= snapshots.length)
setSnapshotIndex(snapshots.length - 1); setSnapshotIndex(snapshots.length - 1);
}, [snapshotIndex, snapshots]); }, [snapshotIndex, snapshots]);