diff --git a/src/panels/config/js/script/delay.tsx b/src/panels/config/js/script/delay.tsx index da78c3b809..3f1d69da80 100644 --- a/src/panels/config/js/script/delay.tsx +++ b/src/panels/config/js/script/delay.tsx @@ -1,14 +1,12 @@ import { h } from "preact"; import "@polymer/paper-input/paper-input"; -import { onChangeEvent } from "../../../../common/preact/event"; import { AutomationComponent } from "../automation-component"; export default class DelayAction extends AutomationComponent { - private onChange: (obj: any) => void; constructor() { super(); - this.onChange = onChangeEvent.bind(this, "action"); + this.onChange = this.onChange.bind(this); } public render({ action, localize }) { @@ -26,6 +24,20 @@ export default class DelayAction extends AutomationComponent { ); } + + private onChange(ev) { + if ( + !this.initialized || + ev.target.value === this.props.action[ev.target.name] + ) { + return; + } + + this.props.onChange(this.props.index, { + ...this.props.action, + [ev.target.name]: ev.target.value, + }); + } } (DelayAction as any).defaultConfig = { diff --git a/src/panels/config/js/script/wait.tsx b/src/panels/config/js/script/wait.tsx index 365d90c8ed..d9692f6cac 100644 --- a/src/panels/config/js/script/wait.tsx +++ b/src/panels/config/js/script/wait.tsx @@ -18,6 +18,9 @@ export default class WaitAction extends AutomationComponent { // Gets fired on mount. If empty, onChangeEvent removes attribute. // Without the attribute this action is no longer matched to this component. public onTemplateChange(ev) { + if (!this.initialized) { + return; + } this.props.onChange(this.props.index, { ...this.props.action, [ev.target.getAttribute("name")]: ev.target.value,