Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'ngDoCheck' of null #393

@crabouif

Description

@crabouif

I have a form with some flex layout inside. But sometimes when I change the route by a link, the app crash with error

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'ngDoCheck' of null

I found that happen in file flex-layout.es5.js line 2906. The piece of code is

ClassDirective.prototype.ngDoCheck = function () {
        if (!this._classAdapter.hasMediaQueryListener) {
            this._configureMQListener();
        }
        this._ngClassInstance.ngDoCheck();
};

Then if I patch to

    ClassDirective.prototype.ngDoCheck = function () {
        if (!this._classAdapter.hasMediaQueryListener) {
            this._configureMQListener();
        }
        if (this._ngClassInstance) {
            this._ngClassInstance.ngDoCheck();
        }
    };

the issue doesn't apear anymore.

My context is:

@angular/cli: 1.3.2
node: 7.10.1
os: linux x64
@angular/animations: 4.3.6
@angular/cdk: 2.0.0-beta.8
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/core: 4.3.6
@angular/flex-layout: 2.0.0-beta.9
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/router: 4.3.6
@angular/cli: 1.3.2
@angular/compiler-cli: 4.3.6
@angular/language-service: 4.3.6

I dont know if its related, but I have a reactive form and each time the user change something, I save the values. This issue happen after a various number of modifications (and so saves).

    form.valueChanges
      .debounceTime(1000)
      .distinctUntilChanged()
      .filter(v => form.valid)
      .subscribe(v => {
        this.state = FormModelState.Saving;
        (<Observable<Response>>this.save())
          .subscribe(res => {
              this.state = FormModelState.Saved;
              this.error = "";
            },
            e => {
              this.state = FormModelState.SaveError;
              this.error = e;
            }
          );
      });

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Urgent issue that should be resolved before the next re-leasebughas prA PR has been created to address this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions