UI: fixed initial value for targetDashboardId valueChanges pipe

This commit is contained in:
Dmitriymush 2023-12-19 13:44:28 +02:00
parent 45796d253f
commit 1fdbba6fc6

View File

@ -225,7 +225,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
this.fb.control(action ? action.targetDashboardId : null,
[Validators.required])
);
this.setupSelectedDashboardStateIds(action ? action.targetDashboardId : null);
this.setupSelectedDashboardStateIds();
} else {
if (type === WidgetActionType.openDashboardState) {
const displayType = this.getStateDisplayType(action);
@ -339,10 +339,12 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
return res;
}
private setupSelectedDashboardStateIds(targetDashboardId?: string) {
private setupSelectedDashboardStateIds() {
const dashboardControl = this.actionTypeFormGroup.get('targetDashboardId');
this.selectedDashboardStateIds =
this.actionTypeFormGroup.get('targetDashboardId').valueChanges.pipe(
// startWith<string>(targetDashboardId),
dashboardControl.valueChanges.pipe(
startWith(dashboardControl.value),
tap(() => {
this.targetDashboardStateSearchText = '';
}),