Fix errors throw when doing validity checks (#11171)

This commit is contained in:
Charles Gagnon
2020-07-01 14:37:28 -07:00
committed by GitHub
parent d6768ba12e
commit bd801ad8da
3 changed files with 3 additions and 3 deletions

View File

@@ -60,7 +60,7 @@ export interface IModelStore {
getComponentDescriptor(componentId: string): IComponentDescriptor; getComponentDescriptor(componentId: string): IComponentDescriptor;
registerComponent(component: IComponent): void; registerComponent(component: IComponent): void;
unregisterComponent(component: IComponent): void; unregisterComponent(component: IComponent): void;
getComponent(componentId: string): IComponent; getComponent(componentId: string): IComponent | undefined;
/** /**
* Runs on a component immediately if the component exists, or runs on * Runs on a component immediately if the component exists, or runs on
* registration of the component otherwise * registration of the component otherwise

View File

@@ -286,7 +286,7 @@ export abstract class ContainerBase<T> extends ComponentBase {
super(_changeRef, _el); super(_changeRef, _el);
this.items = []; this.items = [];
this._validations.push(() => this.items.every(item => { this._validations.push(() => this.items.every(item => {
return this.modelStore.getComponent(item.descriptor.id).valid; return this.modelStore.getComponent(item.descriptor.id)?.valid || false;
})); }));
} }

View File

@@ -47,7 +47,7 @@ export class ModelStore implements IModelStore {
// TODO notify model for cleanup // TODO notify model for cleanup
} }
getComponent(componentId: string): IComponent { getComponent(componentId: string): IComponent | undefined {
return this._componentMappings[componentId]; return this._componentMappings[componentId];
} }