ref(snapshots): Make the snapshots toolbar presentational and de-duplicate#116477
Open
mtopo27 wants to merge 1 commit into
Open
ref(snapshots): Make the snapshots toolbar presentational and de-duplicate#116477mtopo27 wants to merge 1 commit into
mtopo27 wants to merge 1 commit into
Conversation
Extract the preprod snapshots toolbar into a dedicated snapshotsToolbar.tsx module and make the components purely presentational. DiffModeToggle now takes a showSplit prop instead of calling useBreakpoints(), and the toggles no longer call useOrganization()/trackAnalytics — that wiring moves up into SnapshotMainContent, which passes breakpoints.sm and fires analytics from its onChange handlers. snapshotMainContent.tsx imports the shared components instead of defining its own copies, eliminating the duplication. Also drop the now-unused export on TRANSPARENT_COLOR in diffImageDisplay.tsx (still used internally, no longer imported elsewhere after the de-dupe).
This was referenced May 29, 2026
|
|
||
| const handleViewModeChange = useCallback( | ||
| (mode: ViewMode) => { | ||
| onViewModeChange(mode); |
Contributor
There was a problem hiding this comment.
Bug: The handleOpenSnapshot function calls onViewModeChange directly, bypassing the handleViewModeChange wrapper and skipping analytics tracking when a snapshot is opened from the list view.
Severity: MEDIUM
Suggested Fix
In handleOpenSnapshot, replace the direct call to onViewModeChange('single') with a call to the wrapper function handleViewModeChange('single'). This will ensure the analytics event is correctly tracked when a user opens a snapshot.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/views/preprod/snapshots/main/snapshotMainContent.tsx#L160
Potential issue: When a user opens a snapshot from the list view, the
`handleOpenSnapshot` callback is triggered. This function directly calls the
`onViewModeChange('single')` prop instead of the new `handleViewModeChange` wrapper. As
a result, the `trackAnalytics('preprod.snapshots.details.view_mode_changed', ...)`
event, which is located inside `handleViewModeChange`, is not fired. This leads to a
loss of analytics data for a primary user interaction, contradicting the PR's stated
goal of centralizing analytics wiring within the `SnapshotMainContent` component.
Did we get this right? 👍 / 👎 to inform future reviews.
Contributor
📊 Type Coverage Diff
🔍 1 new type safety issue introducedType assertions (
This is informational only and does not block the PR. |
NicoHinderling
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of a 3-PR stack splitting #115893. PR 1 of 3 — base: `master`.
Refactors the preprod snapshots toolbar so it can be rendered in isolation, without touching production behavior.
What changes
Behavior
No production behavior change intended. The old `DiffModeToggle` did `const breakpoints = useBreakpoints(); breakpoints.sm ? …`, which is exactly what `showSplit={breakpoints.sm}` now passes.
Follow-ups in the stack