Skip to content

fix(preprod): Prefer display_name for snapshot sidebar labels#111779

Merged
runningcode merged 2 commits into
masterfrom
no/fix/snapshot-sidebar-display-name
Mar 30, 2026
Merged

fix(preprod): Prefer display_name for snapshot sidebar labels#111779
runningcode merged 2 commits into
masterfrom
no/fix/snapshot-sidebar-display-name

Conversation

@runningcode

@runningcode runningcode commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

The snapshot sidebar label fallback chain was group → image_file_name, which meant display_name was never shown even when set. This updates all three label sites to prefer display_name first: display_name → group → image_file_name.

Grouping logic (getImageGroup) is unchanged — only the displayed label is affected.

Before:
Screenshot 2026-03-30 at 11 09 02

After:
Screenshot 2026-03-30 at 10 59 49

The sidebar label fallback chain was group → image_file_name, skipping
display_name entirely. Now prefers display_name when available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 30, 2026
@runningcode runningcode marked this pull request as ready for review March 30, 2026 09:10
@runningcode runningcode requested a review from a team as a code owner March 30, 2026 09:10
@cameroncooke

Copy link
Copy Markdown
Contributor

Looks good to me, but I'll defer to others who are more involved as there may be edge cases I'm not aware of.

Adjust the fallback order to group → display_name → image_file_name
so that explicit grouping takes precedence over display_name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Fallback chain order contradicts intended display_name priority
    • Changed the fallback chain from 'group ?? display_name ?? image_file_name' to 'display_name ?? group ?? image_file_name' at all three label sites to correctly prioritize display_name first.

Create PR

Or push these changes by commenting:

@cursor push 74efdf9c01
Preview (74efdf9c01)
diff --git a/static/app/views/preprod/snapshots/snapshots.tsx b/static/app/views/preprod/snapshots/snapshots.tsx
--- a/static/app/views/preprod/snapshots/snapshots.tsx
+++ b/static/app/views/preprod/snapshots/snapshots.tsx
@@ -129,8 +129,8 @@
         }
         for (const [groupKey, groupedPairs] of groups) {
           const label =
+            groupedPairs[0]!.head_image.display_name ??
             groupedPairs[0]!.head_image.group ??
-            groupedPairs[0]!.head_image.display_name ??
             groupedPairs[0]!.head_image.image_file_name;
           items.push({
             type,
@@ -158,7 +158,7 @@
         }
         for (const [groupKey, images] of groups) {
           const label =
-            images[0]!.group ?? images[0]!.display_name ?? images[0]!.image_file_name;
+            images[0]!.display_name ?? images[0]!.group ?? images[0]!.image_file_name;
           items.push({
             type,
             key: `${type}:${groupKey}`,
@@ -198,7 +198,7 @@
       .sort(([a], [b]) => a.localeCompare(b))
       .map(([groupKey, images]) => {
         const label =
-          images[0]!.group ?? images[0]!.display_name ?? images[0]!.image_file_name;
+          images[0]!.display_name ?? images[0]!.group ?? images[0]!.image_file_name;
         return {
           type: 'solo' as const,
           key: `solo:${groupKey}`,

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

for (const [groupKey, groupedPairs] of groups) {
const label =
groupedPairs[0]!.head_image.group ??
groupedPairs[0]!.head_image.display_name ??

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fallback chain order contradicts intended display_name priority

High Severity

The PR intends the fallback chain to be display_name → group → image_file_name, but the code implements group ?? display_name ?? image_file_name at all three label sites. Because ?? evaluates left-to-right, group is still preferred over display_name, so display_name is only used when group is nullish — the opposite of what's described. The display_name term needs to come before group in the chain.

Additional Locations (2)
Fix in Cursor Fix in Web

@runningcode runningcode merged commit 1a4b4cc into master Mar 30, 2026
75 checks passed
@runningcode runningcode deleted the no/fix/snapshot-sidebar-display-name branch March 30, 2026 16:11
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants