Skip to content

Commit ec7dd91

Browse files
[7.9] [Metrics UI] Fix all threshold alert conditions disappearing due to alert prefill (#73708) (#73914)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 6f73563 commit ec7dd91

File tree

1 file changed

+2
-2
lines changed
  • x-pack/plugins/infra/public/alerting/metric_threshold/components

1 file changed

+2
-2
lines changed

x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export const Expressions: React.FC<Props> = (props) => {
185185

186186
const preFillAlertCriteria = useCallback(() => {
187187
const md = alertsContext.metadata;
188-
if (md && md.currentOptions?.metrics) {
188+
if (md?.currentOptions?.metrics?.length) {
189189
setAlertParams(
190190
'criteria',
191191
md.currentOptions.metrics.map((metric) => ({
@@ -249,7 +249,7 @@ export const Expressions: React.FC<Props> = (props) => {
249249
if (!alertParams.sourceId) {
250250
setAlertParams('sourceId', source?.id || 'default');
251251
}
252-
}, [alertsContext.metadata, defaultExpression, source]); // eslint-disable-line react-hooks/exhaustive-deps
252+
}, [alertsContext.metadata, source]); // eslint-disable-line react-hooks/exhaustive-deps
253253

254254
const handleFieldSearchChange = useCallback(
255255
(e: ChangeEvent<HTMLInputElement>) => onFilterChange(e.target.value),

0 commit comments

Comments
 (0)