diff --git a/static/app/components/events/groupingInfo/groupingInfo.tsx b/static/app/components/events/groupingInfo/groupingInfo.tsx index cc47a1d51b872d..3b04ca8c042046 100644 --- a/static/app/components/events/groupingInfo/groupingInfo.tsx +++ b/static/app/components/events/groupingInfo/groupingInfo.tsx @@ -40,20 +40,22 @@ export default function GroupingInfo({ }); const variants = groupInfo?.variants - ? Object.values(groupInfo.variants).sort((a, b) => { - // Sort contributing variants before non-contributing ones - if (a.contributes && !b.contributes) { - return -1; - } - if (b.contributes && !a.contributes) { - return 1; - } + ? Object.values(groupInfo.variants) + .filter((variant): variant is NonNullable => variant !== null) + .sort((a, b) => { + // Sort contributing variants before non-contributing ones + if (a.contributes && !b.contributes) { + return -1; + } + if (b.contributes && !a.contributes) { + return 1; + } - // Sort by description alphabetically - const descA = a.description?.toLowerCase() ?? ''; - const descB = b.description?.toLowerCase() ?? ''; - return descA.localeCompare(descB); - }) + // Sort by description alphabetically + const descA = a.description?.toLowerCase() ?? ''; + const descB = b.description?.toLowerCase() ?? ''; + return descA.localeCompare(descB); + }) : []; const feedbackComponent = (