UI: Fixed switch control widget, didn't update state after get value in call rpc

This commit is contained in:
Vladyslav_Prykhodko 2021-03-29 19:03:44 +03:00
parent 5bb252b418
commit 766594a7aa

View File

@ -121,7 +121,7 @@ export class SwitchComponent extends PageComponent implements OnInit, OnDestroy
this.switchResize$ = new ResizeObserver(() => { this.switchResize$ = new ResizeObserver(() => {
this.resize(); this.resize();
}) });
this.switchResize$.observe(this.switchContainerRef.nativeElement); this.switchResize$.observe(this.switchContainerRef.nativeElement);
this.init(); this.init();
} }
@ -260,6 +260,7 @@ export class SwitchComponent extends PageComponent implements OnInit, OnDestroy
this.ctx.controlApi.sendTwoWayCommand(this.getValueMethod, null, this.requestTimeout).subscribe( this.ctx.controlApi.sendTwoWayCommand(this.getValueMethod, null, this.requestTimeout).subscribe(
(responseBody) => { (responseBody) => {
this.setValue(this.parseValueFunction(responseBody)); this.setValue(this.parseValueFunction(responseBody));
this.ctx.detectChanges();
}, },
() => { () => {
const errorText = this.ctx.defaultSubscription.rpcErrorText; const errorText = this.ctx.defaultSubscription.rpcErrorText;