Skip to content

Commit

Permalink
fix(core): fix various errors during SSR
Browse files Browse the repository at this point in the history
fix #1821
  • Loading branch information
aitboudad committed Oct 7, 2019
1 parent 6f7a10a commit 921a451
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 7 additions & 4 deletions src/core/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ export function clone(value: any): any {
!isObject(value)
|| value instanceof RegExp
|| value instanceof Observable
|| value instanceof FileList
|| value instanceof File
|| value instanceof Blob
|| /* instanceof SafeHtmlImpl */ value.changingThisBreaksApplicationSecurity) {
|| /* instanceof SafeHtmlImpl */ value.changingThisBreaksApplicationSecurity
|| (typeof window !== 'undefined' && (
value instanceof FileList
|| value instanceof File
|| value instanceof Blob
))
) {
return value;
}

Expand Down
10 changes: 5 additions & 5 deletions src/material/form-field/src/form-field.wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ export class FormlyWrapperFormField extends FieldWrapper<MatFormlyFieldConfig> i
private focusMonitor: FocusMonitor,
) {
super();

focusMonitor.monitor(elementRef, true).subscribe(origin => {
this.field.focus = !!origin;
this.stateChanges.next();
});
}

ngOnInit() {
Expand All @@ -82,6 +77,11 @@ export class FormlyWrapperFormField extends FieldWrapper<MatFormlyFieldConfig> i
if (this.formlyField.hide && this.formlyField.templateOptions!.appearance === 'outline') {
this.initialGapCalculated = true;
}

this.focusMonitor.monitor(this.elementRef, true).subscribe(origin => {
this.field.focus = !!origin;
this.stateChanges.next();
});
}

ngAfterContentChecked() {
Expand Down

0 comments on commit 921a451

Please sign in to comment.