Skip to content

Commit d7be45e

Browse files
committed
Fix eslint
1 parent 2815ca3 commit d7be45e

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

  • x-pack/plugins/infra/public/alerting/inventory/components

x-pack/plugins/infra/public/alerting/inventory/components/metric.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff 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) => {

0 commit comments

Comments
 (0)