Skip to content

Commit

Permalink
[Metrics UI] Fix all conditions disappearing due to alert prefill
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed Jul 29, 2020
1 parent d9a6461 commit aaf59b7
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 aaf59b7

Please sign in to comment.