Skip to content

Commit

Permalink
Remove ruleThrottle state
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed Jan 9, 2023
1 parent 339c67e commit d748d54
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export const ActionNotifyWhen = ({
onNotifyWhenChange,
onThrottleChange,
}: RuleNotifyWhenProps) => {
const [ruleThrottle, setRuleThrottle] = useState<number>(throttle || 1);
const [showCustomThrottleOpts, setShowCustomThrottleOpts] = useState<boolean>(false);
const [notifyWhenValue, setNotifyWhenValue] =
useState<RuleNotifyWhenType>(DEFAULT_NOTIFY_WHEN_VALUE);
Expand All @@ -157,11 +156,11 @@ export const ActionNotifyWhen = ({
// so wait for onNotifyWhenChange to process before calling onThrottleChange
setTimeout(
() =>
onThrottleChange(newValue === 'onThrottleInterval' ? ruleThrottle : null, throttleUnit),
onThrottleChange(newValue === 'onThrottleInterval' ? throttle ?? 1 : null, throttleUnit),
100
);
},
[onNotifyWhenChange, setNotifyWhenValue, onThrottleChange, ruleThrottle, throttleUnit]
[onNotifyWhenChange, setNotifyWhenValue, onThrottleChange, throttleUnit]
);

const labelForRuleRenotify = [
Expand Down Expand Up @@ -197,7 +196,7 @@ export const ActionNotifyWhen = ({
<EuiFlexItem grow={2}>
<EuiFieldNumber
min={1}
value={ruleThrottle}
value={throttle ?? 1}
name="throttle"
data-test-subj="throttleInput"
prepend={i18n.translate(
Expand All @@ -213,7 +212,6 @@ export const ActionNotifyWhen = ({
map((value) => parseInt(value, 10)),
filter((value) => !isNaN(value)),
map((value) => {
setRuleThrottle(value);
onThrottleChange(value, throttleUnit);
})
);
Expand Down

0 comments on commit d748d54

Please sign in to comment.