Skip to content

Injecting AngularFireAuth to component triggers ChangeDetection continuously #1544

@tomsgit

Description

@tomsgit

Version info

Angular: 5.2.0

Firebase: 4.12.1

AngularFire: 5.0.0-rc.6

Other (e.g. Ionic/Cordova, Node, browser, operating system): Windows 10, Google Chrome 65,npm: '5.6.0', node: '8.9.1'

How to reproduce these conditions

  1. Inject AngularFireAuth into the AppComponent.
  2. Create get method for a property. Log a message to console in the method.
  3. Refer the property in the template using {{}}
  4. View the application in chrome, observe console using developer tools

The log message in the get method is printed continuously as if in a loop. This behavior disappears if the constructor injection of AngularFireAuth is removed.

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

https://embed.plnkr.co/S3cm7hpJImTtaTSa9Om0/

Steps to set up and reproduce
Create new Angular app. Add AngularFire2 and Firebase modules.

Sample data and security rules
None

None

Debug output

Please see attachment.

Expected behavior

The get method is called only once. The injected AngularFireAuth does not trigger ChangeDetection in Angular.

Actual behavior

The log message in the get method is printed continuously as if in a loop due to ChangeDetection being triggered.

localhost-1522757258645.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions