ref(snapshots): Add shared context for snapshots react code#114390
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fabc76f. Configure here.
| listItems, | ||
| isSoloView, | ||
| onToggleSoloView: handleToggleView, | ||
| comparisonType: data?.comparison_type, |
There was a problem hiding this comment.
Context uses raw API value instead of derived comparisonType
Medium Severity
The context value sets comparisonType: data?.comparison_type (the raw API response), but the old prop-based code passed the locally derived comparisonType variable (line 209), which applies viewOverride logic (viewOverride === 'solo' ? 'solo' : ...) and a 'solo' fallback default. This means the viewOverride URL query parameter is now ignored by all consuming components, and when data?.comparison_type is undefined, the sort dropdown and solo/diff toggle in SnapshotMainContent will behave incorrectly.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit fabc76f. Configure here.



Refactors the snapshot viewer React code to reduce prop drilling via a shared context, and improves several UX patterns:
Shared context (
SnapshotViewerContext)SnapshotMainContent→ child components. Sidebar and main content now consume state viauseSnapshotViewer().URL-driven state
viewMode,sortBy, and filter state from localStorage/component state to URL query params withhistory: 'push', so browser back/forward navigates between views and selections.Image buffering for smooth navigation
useBufferedImageUrlhook that pre-decodes the next image before swappingsrc, eliminating the white flash when navigating between snapshots in single view.Sidebar group-based rendering
Per-image diff threshold (backend)
ImageMetadatanow supports an optionaldiff_thresholdfield. The comparison task uses per-image threshold when set, falling back to the global snapshot-level threshold.Header / card polish
Space/Enterboth toggle selection; arrow left/right direction corrected for list↔single.Other
selectedTypesquery param to match the new URL scheme.display: nonetoggling instead of conditional rendering to preserve zoom/slider state across mode switches.