Skip to content

Commit

Permalink
[Metrics UI] Fix all threshold alert conditions disappearing due to a…
Browse files Browse the repository at this point in the history
…lert prefill (#73708)

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
Zacqary and elasticmachine authored Jul 31, 2020
1 parent d3f498a commit 5fa162c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const Expressions: React.FC<Props> = (props) => {

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

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

0 comments on commit 5fa162c

Please sign in to comment.