Browse Source

fix(dashboards): fixes custom metrics not showing up in yaxis in widget builder (#36447)

custom metrics weren't showing up in the yaxis in the builder because the context consumer wasnt being used in the yaxis step component
edwardgou-sentry 2 years ago
parent
commit
7d08e9a41a

+ 8 - 1
static/app/views/dashboardsV2/widgetBuilder/buildSteps/yAxisStep/yAxisSelector/index.tsx

@@ -6,6 +6,7 @@ import {t} from 'sentry/locale';
 import space from 'sentry/styles/space';
 import {TagCollection} from 'sentry/types';
 import {QueryFieldValue} from 'sentry/utils/discover/fields';
+import useCustomMeasurements from 'sentry/utils/useCustomMeasurements';
 import useOrganization from 'sentry/utils/useOrganization';
 import {getDatasetConfig} from 'sentry/views/dashboardsV2/datasetConfig/base';
 import {DisplayType, Widget} from 'sentry/views/dashboardsV2/types';
@@ -40,6 +41,8 @@ export function YAxisSelector({
   const organization = useOrganization();
   const datasetConfig = getDatasetConfig(widgetType);
 
+  const {customMeasurements} = useCustomMeasurements();
+
   function handleAddOverlay(event: React.MouseEvent) {
     event.preventDefault();
 
@@ -89,7 +92,11 @@ export function YAxisSelector({
         <QueryFieldWrapper key={`${fieldValue}:${i}`}>
           <QueryField
             fieldValue={fieldValue}
-            fieldOptions={datasetConfig.getTableFieldOptions(organization, tags)}
+            fieldOptions={datasetConfig.getTableFieldOptions(
+              organization,
+              tags,
+              customMeasurements
+            )}
             onChange={value => handleChangeQueryField(value, i)}
             filterPrimaryOptions={datasetConfig.filterYAxisOptions?.(displayType)}
             filterAggregateParameters={datasetConfig.filterYAxisAggregateParams?.(