[RAM] Fix error message flash and throttle value reset (#154497)

## Summary

Fixes #152943

- Error message will no longer flash when switching notify when to `On
custom action intervals`
- Switching away and back to `On custom action intervals` will preserve
the throttle value as well as the throttle unit
This commit is contained in:
Zacqary Adam Xeper 2023-04-10 11:29:37 -05:00 committed by GitHub
parent b6a113ccfa
commit 04f1be1edd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -258,8 +258,10 @@ export const ActionTypeForm = ({
)}
onThrottleChange={useCallback(
(throttle: number | null, throttleUnit: string) => {
setActionThrottle(throttle);
setActionThrottleUnit(throttleUnit);
if (throttle) {
setActionThrottle(throttle);
setActionThrottleUnit(throttleUnit);
}
setActionFrequencyProperty(
'throttle',
throttle ? `${throttle}${throttleUnit}` : null,

View file

@ -60,7 +60,8 @@ export function validateBaseProperties(
}
const invalidThrottleActions = ruleObject.actions.filter((a) => {
const throttleDuration = a.frequency?.throttle ? parseDuration(a.frequency.throttle) : 0;
if (!a.frequency?.throttle) return false;
const throttleDuration = parseDuration(a.frequency.throttle);
const intervalDuration =
ruleObject.schedule.interval && ruleObject.schedule.interval.length > 1
? parseDuration(ruleObject.schedule.interval)