From 7ee92f3fc88386b0e67a66f5a471c854a02bd7c9 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Fri, 6 Aug 2021 16:13:05 +0200 Subject: [PATCH] fix(trace-viewer): when clicking on a step no snapshot was shown (#8038) --- src/web/traceViewer/ui/snapshotTab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/traceViewer/ui/snapshotTab.tsx b/src/web/traceViewer/ui/snapshotTab.tsx index e911528a36..960fb83535 100644 --- a/src/web/traceViewer/ui/snapshotTab.tsx +++ b/src/web/traceViewer/ui/snapshotTab.tsx @@ -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 }[]; React.useEffect(() => { - if (snapshotIndex >= snapshots.length) + if (snapshots.length >= 1 && snapshotIndex >= snapshots.length) setSnapshotIndex(snapshots.length - 1); }, [snapshotIndex, snapshots]);