Browse Source

fix(mertics): Handle undefined widget interval (#72674)

Closes https://github.com/getsentry/sentry/issues/72600
ArthurKnaus 9 months ago
parent
commit
c8c9b2167f

+ 1 - 0
static/app/utils/metrics/dashboard.tsx

@@ -22,6 +22,7 @@ export function convertToDashboardWidget(
   displayType?: MetricDisplayType,
   title = ''
 ): Widget {
+  // TODO: Ged rid of ts-expect-error
   // @ts-expect-error TODO: pass interval
   return {
     title,

+ 2 - 1
static/app/views/dashboards/metrics/widgetCard.tsx

@@ -81,7 +81,8 @@ export function MetricWidgetCard({
   const widgetMQL = useMemo(() => getWidgetTitle(metricQueries), [metricQueries]);
 
   const {interval: validatedInterval} = useMetricsIntervalOptions({
-    interval: widget.interval,
+    // TODO: Figure out why this can be undefined
+    interval: widget.interval ?? '',
     hasSetMetric,
     datetime: selection.datetime,
     onIntervalChange: EMPTY_FN,