File tree Expand file tree Collapse file tree
x-pack/plugins/infra/public/alerting/inventory/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,11 +107,14 @@ export const MetricExpression = ({
107107 ) ;
108108
109109 const expressionDisplayValue = useMemo (
110- ( ) =>
111- ( customMetricTabOpen
110+ ( ) => {
111+ return customMetricTabOpen
112112 ? customMetric ?. field && getCustomMetricLabel ( customMetric )
113- : metric ?. text ) || firstFieldOption . text ,
114- [ customMetricTabOpen , metric ?. text , customMetric ?. field , firstFieldOption ]
113+ : metric ?. text || firstFieldOption . text ;
114+ } ,
115+ // The ?s are confusing eslint here, so...
116+ // eslint-disable-next-line react-hooks/exhaustive-deps
117+ [ customMetricTabOpen , metric , customMetric , firstFieldOption ]
115118 ) ;
116119
117120 const onChangeTab = useCallback (
@@ -163,7 +166,7 @@ export const MetricExpression = ({
163166 } ;
164167 if ( SnapshotCustomMetricInputRT . is ( newCustomMetric ) ) debouncedOnChangeCustom ( newCustomMetric ) ;
165168 } ,
166- [ customMetric , onChangeCustom ]
169+ [ customMetric , debouncedOnChangeCustom ]
167170 ) ;
168171
169172 const availablefieldsOptions = metrics . map ( ( m ) => {
You can’t perform that action at this time.
0 commit comments