diff --git a/packages/forms/src/model.ts b/packages/forms/src/model.ts index 70c42481eae64..ddbcfd76fc946 100644 --- a/packages/forms/src/model.ts +++ b/packages/forms/src/model.ts @@ -52,17 +52,21 @@ function _find(control: AbstractControl, path: Array| string, del } if (Array.isArray(path) && path.length === 0) return null; - return path.reduce((v: AbstractControl | null, name) => { - if (v instanceof FormGroup) { - return v.controls.hasOwnProperty(name as string) ? v.controls[name] : null; - } - - if (v instanceof FormArray) { - return v.at(name) || null; + // Not using Array.reduce here due to a Chrome 80 bug + // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 + let controlToFind: AbstractControl|null = control; + path.forEach((name: string | number) => { + if (controlToFind instanceof FormGroup) { + controlToFind = controlToFind.controls.hasOwnProperty(name as string) ? + controlToFind.controls[name] : + null; + } else if (controlToFind instanceof FormArray) { + controlToFind = controlToFind.at(name) || null; + } else { + controlToFind = null; } - - return null; - }, control); + }); + return controlToFind; } function coerceToValidator( diff --git a/packages/forms/src/validators.ts b/packages/forms/src/validators.ts index 116d306e86e14..0b7a171bf3d84 100644 --- a/packages/forms/src/validators.ts +++ b/packages/forms/src/validators.ts @@ -465,9 +465,13 @@ function _executeAsyncValidators(control: AbstractControl, validators: AsyncVali } function _mergeErrors(arrayOfErrors: ValidationErrors[]): ValidationErrors|null { - const res: {[key: string]: any} = - arrayOfErrors.reduce((res: ValidationErrors | null, errors: ValidationErrors | null) => { - return errors != null ? {...res !, ...errors} : res !; - }, {}); + let res: {[key: string]: any} = {}; + + // Not using Array.reduce here due to a Chrome 80 bug + // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 + arrayOfErrors.forEach((errors: ValidationErrors | null) => { + res = errors != null ? {...res !, ...errors} : res !; + }); + return Object.keys(res).length === 0 ? null : res; }