From b900add24cc5202d83c093bf09184b9023d23905 Mon Sep 17 00:00:00 2001 From: Max Topolsky <30879163+mtopo27@users.noreply.github.com> Date: Wed, 8 Apr 2026 12:18:32 -0400 Subject: [PATCH 1/2] feat(preprod): Sort insight diff by total potential savings Sort insights by total_savings_change descending within each tab so the biggest opportunities surface first. Fixes EME-997 --- .../preprod/buildComparison/main/insightComparisonSection.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx b/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx index 4038eb78436686..87bed12d07b568 100644 --- a/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx +++ b/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx @@ -150,6 +150,10 @@ export function InsightComparisonSection({ } } + for (const insights of Object.values(byTab)) { + insights.sort((a, b) => b.total_savings_change - a.total_savings_change); + } + return { byTab, counts: { From 7d8d801c693f4963f27c680a03d6f651429e70dc Mon Sep 17 00:00:00 2001 From: Max Topolsky <30879163+mtopo27@users.noreply.github.com> Date: Wed, 8 Apr 2026 13:48:52 -0400 Subject: [PATCH 2/2] fix(preprod): Sort resolved insights ascending for correct ordering Resolved insights have negative total_savings_change values, so ascending sort puts the biggest savings first in that tab. --- .../buildComparison/main/insightComparisonSection.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx b/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx index 87bed12d07b568..0e30e59fd9dcf9 100644 --- a/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx +++ b/static/app/views/preprod/buildComparison/main/insightComparisonSection.tsx @@ -150,8 +150,12 @@ export function InsightComparisonSection({ } } - for (const insights of Object.values(byTab)) { - insights.sort((a, b) => b.total_savings_change - a.total_savings_change); + for (const [tab, insights] of Object.entries(byTab)) { + insights.sort((a, b) => + tab === 'resolved' + ? a.total_savings_change - b.total_savings_change + : b.total_savings_change - a.total_savings_change + ); } return {