fix(preprod): Prefer display_name for snapshot sidebar labels#111779
Conversation
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>
|
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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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.
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 ?? |
There was a problem hiding this comment.
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.



The snapshot sidebar label fallback chain was
group → image_file_name, which meantdisplay_namewas never shown even when set. This updates all three label sites to preferdisplay_namefirst:display_name → group → image_file_name.Grouping logic (
getImageGroup) is unchanged — only the displayed label is affected.Before:

After:
