From be0ccd273ada64ff7afb82c67fb56a309e9f3112 Mon Sep 17 00:00:00 2001 From: isabellaenriquez Date: Mon, 17 Nov 2025 12:07:42 -0500 Subject: [PATCH] fix(spike protection): Handle null threshold --- .../spikeProtection/spikeProtectionHistoryTable.tsx | 13 ++++++++----- static/gsApp/views/spikeProtection/types.ts | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/static/gsApp/views/spikeProtection/spikeProtectionHistoryTable.tsx b/static/gsApp/views/spikeProtection/spikeProtectionHistoryTable.tsx index 9230d673f3cec6..c27b7e1923387b 100644 --- a/static/gsApp/views/spikeProtection/spikeProtectionHistoryTable.tsx +++ b/static/gsApp/views/spikeProtection/spikeProtectionHistoryTable.tsx @@ -18,6 +18,7 @@ import {space} from 'sentry/styles/space'; import type {DataCategoryInfo} from 'sentry/types/core'; import type {Organization} from 'sentry/types/organization'; import type {Project} from 'sentry/types/project'; +import {defined} from 'sentry/utils'; import {getExactDuration} from 'sentry/utils/duration/getExactDuration'; import {decodeScalar} from 'sentry/utils/queryString'; import useApi from 'sentry/utils/useApi'; @@ -130,11 +131,13 @@ class SpikeProtectionHistoryTable extends Component { return [ , - {formatUsageWithUnits( - spike.threshold, - dataCategoryInfo.plural, - getFormatUsageOptions(dataCategoryInfo.plural) - )} + {defined(spike.threshold) + ? formatUsageWithUnits( + spike.threshold, + dataCategoryInfo.plural, + getFormatUsageOptions(dataCategoryInfo.plural) + ) + : '-'} , {duration ? getExactDuration(duration, true) : t('Ongoing')} diff --git a/static/gsApp/views/spikeProtection/types.ts b/static/gsApp/views/spikeProtection/types.ts index 70660c97b53d3c..8df950fffe9f90 100644 --- a/static/gsApp/views/spikeProtection/types.ts +++ b/static/gsApp/views/spikeProtection/types.ts @@ -3,7 +3,7 @@ import type {DataCategoryInfo} from 'sentry/types/core'; export interface SpikeDetails { dataCategory: DataCategoryInfo['name']; start: string; - threshold: number; + threshold: number | null; dropped?: number; duration?: number | null; end?: string;