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 (elastic#73708)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
Zacqary and elasticmachine committed Jul 31, 2020
1 parent 5386c04 commit 3579e43
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 3579e43

Please sign in to comment.