Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(visual_review): skip hidden quarantined snapshots when navigating (#64061)

Paul D'Ambra6dc00f7d2994
diff --git a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
index f8d010cfbc1d..04b0552261c0 100644
--- a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
@@ -258,21 +258,23 @@ export function VisualReviewRunScene(): JSX.Element {
const hiddenQuarantinedCount = navSnapshots.length - visibleNavSnapshots.length
const showQuarantinedToggle = quarantinedNavCount > 0 && (hiddenQuarantinedCount > 0 || showQuarantinedThumbnails)
+ // Navigate over what's actually visible — when quarantined items are hidden, next/previous
+ // must skip them rather than selecting a hidden quarantined snapshot.
const currentIndex = selectedSnapshot
- ? navSnapshots.findIndex((s: SnapshotApi) => s.id === selectedSnapshot.id)
+ ? visibleNavSnapshots.findIndex((s: SnapshotApi) => s.id === selectedSnapshot.id)
: -1
const hasPrevious = currentIndex > 0
- const hasNext = currentIndex >= 0 && currentIndex < navSnapshots.length - 1
+ const hasNext = currentIndex >= 0 && currentIndex < visibleNavSnapshots.length - 1
const goToPrevious = (): void => {
if (hasPrevious) {
- setSelectedSnapshotId(navSnapshots[currentIndex - 1].id)
+ setSelectedSnapshotId(visibleNavSnapshots[currentIndex - 1].id)
}
}
const goToNext = (): void => {
if (hasNext) {
- setSelectedSnapshotId(navSnapshots[currentIndex + 1].id)
+ setSelectedSnapshotId(visibleNavSnapshots[currentIndex + 1].id)
}
}
@@ -281,7 +283,7 @@ export function VisualReviewRunScene(): JSX.Element {
p: { action: goToPrevious, disabled: !hasPrevious },
n: { action: goToNext, disabled: !hasNext },
},
- [currentIndex, navSnapshots.length]
+ [currentIndex, visibleNavSnapshots.length]
)
// Show skeleton only on initial load — once `run` is populated, keep showing it
@@ -542,7 +544,7 @@ export function VisualReviewRunScene(): JSX.Element {
onClick={toggleQuarantinedThumbnails}
/>
)}
- {navSnapshots.length > 1 && (
+ {visibleNavSnapshots.length > 1 && (
<div className="flex items-center gap-2">
<LemonButton
size="xsmall"
@@ -556,7 +558,7 @@ export function VisualReviewRunScene(): JSX.Element {
</LemonButton>
{currentIndex >= 0 && (
<span className="text-xs text-muted">
- {currentIndex + 1} of {navSnapshots.length}
+ {currentIndex + 1} of {visibleNavSnapshots.length}
</span>
)}
<LemonButton
diff --git a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
index 8098394b6019..157ee9ae6ebd 100644
--- a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
@@ -363,10 +363,18 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
],
}
- // Find the next pending snapshot in sorted order before the async call
+ // Find the next pending snapshot in sorted order before the async call.
+ // Skip quarantined snapshots when they're hidden, otherwise approving advances
+ // onto an unrelated quarantined item the user can't see in the thumbnail strip.
const sorted = values.sortedChangedSnapshots
const currentIdx = sorted.findIndex((s) => s.id === snapshot.id)
- const nextPending = sorted.slice(currentIdx + 1).find((s) => s.review_state === 'pending')
+ const nextPending = sorted
+ .slice(currentIdx + 1)
+ .find(
+ (s) =>
+ s.review_state === 'pending' &&
+ (values.showQuarantinedThumbnails || !values.quarantinedIdentifierSet.has(s.identifier))
+ )
try {
await visualReviewRunsApproveCreate(String(values.currentProjectId), props.runId, approvalPayload)