From 14b4c8279102e19304e2ccc80690a0937a4175c1 Mon Sep 17 00:00:00 2001 From: Scott Cooper Date: Thu, 29 Aug 2024 12:59:00 -0700 Subject: [PATCH] ref(ui): Remove unreachable ?? paths (#76744) --- static/app/components/forms/model.tsx | 2 +- .../common/queries/useResourcesQuery.ts | 4 +--- ...eProjectWebVitalsScoresTimeseriesQuery.tsx | 4 ++-- .../insights/queues/charts/latencyChart.tsx | 22 +++++++++---------- .../queues/charts/throughputChart.tsx | 22 +++++++++---------- .../traceRenderers/traceTextMeasurer.tsx | 4 ++-- .../charts/projectSessionsChartRequest.tsx | 5 ++--- webpack.config.ts | 2 +- 8 files changed, 29 insertions(+), 36 deletions(-) diff --git a/static/app/components/forms/model.tsx b/static/app/components/forms/model.tsx index 6711f0373ed543..230d68a47ab7d5 100644 --- a/static/app/components/forms/model.tsx +++ b/static/app/components/forms/model.tsx @@ -241,7 +241,7 @@ class FormModel { * Set form options */ setFormOptions(options: FormOptions) { - this.options = {...this.options, ...options} || {}; + this.options = {...this.options, ...options}; } /** diff --git a/static/app/views/insights/browser/common/queries/useResourcesQuery.ts b/static/app/views/insights/browser/common/queries/useResourcesQuery.ts index 82deeb275623e6..7ce7f2f389a408 100644 --- a/static/app/views/insights/browser/common/queries/useResourcesQuery.ts +++ b/static/app/views/insights/browser/common/queries/useResourcesQuery.ts @@ -169,9 +169,7 @@ export const getResourceTypeFilter = ( let resourceFilter: string[] = [`${SPAN_OP}:resource.*`]; if (selectedSpanOp) { - resourceFilter = [SPAN_OP_FILTER[selectedSpanOp].join(' OR ')] || [ - `${SPAN_OP}:${selectedSpanOp}`, - ]; + resourceFilter = [SPAN_OP_FILTER[selectedSpanOp].join(' OR ')]; } else if (defaultResourceTypes) { resourceFilter = [ defaultResourceTypes.map(type => SPAN_OP_FILTER[type].join(' OR ')).join(' OR '), diff --git a/static/app/views/insights/browser/webVitals/queries/storedScoreQueries/useProjectWebVitalsScoresTimeseriesQuery.tsx b/static/app/views/insights/browser/webVitals/queries/storedScoreQueries/useProjectWebVitalsScoresTimeseriesQuery.tsx index 28b888a769d898..346c69c2ce0583 100644 --- a/static/app/views/insights/browser/webVitals/queries/storedScoreQueries/useProjectWebVitalsScoresTimeseriesQuery.tsx +++ b/static/app/views/insights/browser/webVitals/queries/storedScoreQueries/useProjectWebVitalsScoresTimeseriesQuery.tsx @@ -136,7 +136,7 @@ export const useProjectWebVitalsScoresTimeseriesQuery = ({ data[webVital].push({ value: result?.data?.[`weighted_performance_score(measurements.score.${webVital})`] - ?.data[index][1][0].count * 100 ?? 0, + ?.data[index][1][0].count * 100, name: interval[0] * 1000, }); }); @@ -148,7 +148,7 @@ export const useProjectWebVitalsScoresTimeseriesQuery = ({ value: result?.data?.[`performance_score(measurements.score.${webVital})`]?.data[ index - ][1][0].count * 100 ?? 0, + ][1][0].count * 100, name: interval[0] * 1000, }); }); diff --git a/static/app/views/insights/queues/charts/latencyChart.tsx b/static/app/views/insights/queues/charts/latencyChart.tsx index 0d20241b9e3918..84fe0b4ec767c9 100644 --- a/static/app/views/insights/queues/charts/latencyChart.tsx +++ b/static/app/views/insights/queues/charts/latencyChart.tsx @@ -28,18 +28,16 @@ export function LatencyChart({error, destination, referrer}: Props) { top: '8px', bottom: '0', }} - data={ - [ - { - seriesName: t('Average Time in Queue'), - data: data['avg(messaging.message.receive.latency)'].data, - }, - { - seriesName: t('Average Processing Time'), - data: data['avg(span.duration)'].data, - }, - ] ?? [] - } + data={[ + { + seriesName: t('Average Time in Queue'), + data: data['avg(messaging.message.receive.latency)'].data, + }, + { + seriesName: t('Average Processing Time'), + data: data['avg(span.duration)'].data, + }, + ]} loading={isPending} error={error} chartColors={CHART_PALETTE[2].slice(1)} diff --git a/static/app/views/insights/queues/charts/throughputChart.tsx b/static/app/views/insights/queues/charts/throughputChart.tsx index 6604069b493a4e..857489ccd946ca 100644 --- a/static/app/views/insights/queues/charts/throughputChart.tsx +++ b/static/app/views/insights/queues/charts/throughputChart.tsx @@ -36,18 +36,16 @@ export function ThroughputChart({error, destination, referrer}: Props) { top: '8px', bottom: '0', }} - data={ - [ - { - seriesName: t('Published'), - data: publishData['spm()'].data, - }, - { - seriesName: t('Processed'), - data: processData['spm()'].data, - }, - ] ?? [] - } + data={[ + { + seriesName: t('Published'), + data: publishData['spm()'].data, + }, + { + seriesName: t('Processed'), + data: processData['spm()'].data, + }, + ]} loading={isPublishDataLoading || isProcessDataLoading} error={error} chartColors={CHART_PALETTE[2].slice(1, 3)} diff --git a/static/app/views/performance/newTraceDetails/traceRenderers/traceTextMeasurer.tsx b/static/app/views/performance/newTraceDetails/traceRenderers/traceTextMeasurer.tsx index ab6ea4cdc6ecf6..b5bdcbbf8cfc1d 100644 --- a/static/app/views/performance/newTraceDetails/traceRenderers/traceTextMeasurer.tsx +++ b/static/app/views/performance/newTraceDetails/traceRenderers/traceTextMeasurer.tsx @@ -28,8 +28,8 @@ export class TraceTextMeasurer { return; } - canvas.width = 50 * window.devicePixelRatio ?? 1; - canvas.height = 50 * window.devicePixelRatio ?? 1; + canvas.width = 50 * window.devicePixelRatio; + canvas.height = 50 * window.devicePixelRatio; ctx.font = '11px' + theme.text.family; diff --git a/static/app/views/projectDetail/charts/projectSessionsChartRequest.tsx b/static/app/views/projectDetail/charts/projectSessionsChartRequest.tsx index 4182933a9c3725..ce30e2b87add2d 100644 --- a/static/app/views/projectDetail/charts/projectSessionsChartRequest.tsx +++ b/static/app/views/projectDetail/charts/projectSessionsChartRequest.tsx @@ -256,7 +256,7 @@ class ProjectSessionsChartRequest extends Component< const crashedSessionsPercent = responseData.groups[0]?.series[field].slice( fetchedWithPrevious ? dataMiddleIndex : 0 - )[i] * 100 ?? 0; + )[i] * 100; return { name: interval, @@ -271,8 +271,7 @@ class ProjectSessionsChartRequest extends Component< seriesName: t('Previous Period'), data: responseData.intervals.slice(0, dataMiddleIndex).map((_interval, i) => { const crashedSessionsPercent = - responseData.groups[0]?.series[field].slice(0, dataMiddleIndex)[i] * 100 ?? - 0; + responseData.groups[0]?.series[field].slice(0, dataMiddleIndex)[i] * 100; return { name: responseData.intervals[i + dataMiddleIndex], diff --git a/webpack.config.ts b/webpack.config.ts index 3dbcf93a3324ad..b01385ff20528a 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -98,7 +98,7 @@ const SENTRY_EXPERIMENTAL_SPA = const SENTRY_SPA_DSN = SENTRY_EXPERIMENTAL_SPA ? env.SENTRY_SPA_DSN : undefined; const CODECOV_TOKEN = env.CODECOV_TOKEN; // value should come back as either 'true' or 'false' or undefined -const ENABLE_CODECOV_BA = env.CODECOV_ENABLE_BA === 'true' ?? false; +const ENABLE_CODECOV_BA = env.CODECOV_ENABLE_BA === 'true'; // this is the path to the django "sentry" app, we output the webpack build here to `dist` // so that `django collectstatic` and so that we can serve the post-webpack bundles