diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service.ts index 279f47d9e0..7d846ddde4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service.ts @@ -199,22 +199,20 @@ export class DsDynamicTypeBindRelationService { ); // Build up the subscriptions to watch for changes; - if (hasValue(this.dynamicMatchers) || true) { - subscriptions.push(valueChanges.subscribe(() => { - // Iterate each matcher + subscriptions.push(valueChanges.subscribe(() => { + // Iterate each matcher + if (hasValue(this.dynamicMatchers)) { this.dynamicMatchers.forEach((matcher) => { - // Find the relation const relation = this.dynamicFormRelationService.findRelationByMatcher((model as any).typeBindRelations, matcher); - // If the relation is defined, get matchesCondition result and pass it to the onChange event listener if (relation !== undefined) { const hasMatch = this.matchesCondition(relation, matcher); matcher.onChange(hasMatch, model, control, this.injector); } }); - })); - } + } + })); } }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.ts index 9f0da2ac12..5af9b2bd32 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.ts @@ -38,14 +38,11 @@ export class DynamicDsDatePickerModel extends DynamicDateControlModel { this.typeBindRelations = config.typeBindRelations ? config.typeBindRelations : []; this.hiddenUpdates = new BehaviorSubject(this.hidden); - // Asynchronously hide parent if this is hidden - setTimeout((hidden: boolean) => { - this.hidden = hidden; - const parentModel = this.getRootParent(this); - if (parentModel && isNotUndefined(parentModel.hidden)) { - parentModel.hidden = hidden; - } - }, 0); + // This was a subscription, then an async setTimeout, but it seems unnecessary + const parentModel = this.getRootParent(this); + if (parentModel && isNotUndefined(parentModel.hidden)) { + parentModel.hidden = this.hidden; + } } private getRootParent(model: any): DynamicFormControlModel {