Skip to content

HMR Issues for initializeApp() #1057

@ArthurianX

Description

@ArthurianX

Hi guys, I'm referencing this issue here PatrickJS/angular-hmr#17, it's still a problem, I think I should report it here as well.

Angular:
4.2.5
Firebase:
4.1.3
AngularFire:
4.0.0-rc.1
Other (e.g. Ionic/Cordova, Node, browser, operating system):
AngularClasss Boilerplate with the server:dev:hmr task for starting

How to reproduce these conditions

Just like https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md on step 5, when using the initializeApp after a HMR rebuild the connection the database app fails to load with am error.

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

I have no pluncker yet, I'm using env variables (https://github.com/AngularClass/angular-starter/wiki/How-to-pass-environment-variables%3F) normally, but I even tried hardcoding the API details and app-name itself in the initializeApp parameters and the results are the same

Steps to set up and reproduce

Have the application running and make a change to any component, HMR will reload only what it needs, and then the above error is thrown.

Sample data and security rules

no rules.

{
  "rules": {
    
  }
}

Debug output

AppComponent_Host.ngfactory.js:5 ERROR FirebaseError {code: "app/no-app", message: "Firebase: No Firebase App '[DEFAULT]' has been cre…- call Firebase App.initializeApp() (app/no-app).", name: "[DEFAULT]", ngDebugContext: DebugContext_, ngErrorLogger: function…}
View_AppComponent_Host_0 @ AppComponent_Host.ngfactory.js:5
proxyClass @ compiler.es5.js:14962
DebugContext_.logError @ core.es5.js:13448
ErrorHandler.handleError @ core.es5.js:1080
(anonymous) @ core.es5.js:4468
ZoneDelegate.invoke @ zone.js:391
onInvoke @ core.es5.js:3933
ZoneDelegate.invoke @ zone.js:390
Zone.run @ zone.js:141
(anonymous) @ zone.js:817
ZoneDelegate.invokeTask @ zone.js:424
onInvokeTask @ core.es5.js:3924
ZoneDelegate.invokeTask @ zone.js:423
Zone.runTask @ zone.js:191
drainMicroTaskQueue @ zone.js:584
AppComponent_Host.ngfactory.js:5 ERROR CONTEXT DebugContext_ {view: Object, nodeIndex: 1, nodeDef: Object, elDef: Object, elView: Object}
View_AppComponent_Host_0 @ AppComponent_Host.ngfactory.js:5
proxyClass @ compiler.es5.js:14962
DebugContext_.logError @ core.es5.js:13448
ErrorHandler.handleError @ core.es5.js:1085
(anonymous) @ core.es5.js:4468
ZoneDelegate.invoke @ zone.js:391
onInvoke @ core.es5.js:3933
ZoneDelegate.invoke @ zone.js:390
Zone.run @ zone.js:141
(anonymous) @ zone.js:817
ZoneDelegate.invokeTask @ zone.js:424
onInvokeTask @ core.es5.js:3924
ZoneDelegate.invokeTask @ zone.js:423
Zone.runTask @ zone.js:191
drainMicroTaskQueue @ zone.js:584
main.browser.ts:40 FirebaseError {code: "app/no-app", message: "Firebase: No Firebase App '[DEFAULT]' has been cre…- call Firebase App.initializeApp() (app/no-app).", name: "[DEFAULT]", ngDebugContext: DebugContext_, ngErrorLogger: function…}
(anonymous) @ main.browser.ts:40
ZoneDelegate.invoke @ zone.js:391
Zone.run @ zone.js:141
(anonymous) @ zone.js:817
ZoneDelegate.invokeTask @ zone.js:424
Zone.runTask @ zone.js:191
drainMicroTaskQueue @ zone.js:584

** Output from firebase.database().enableLogging(true); **

** Screenshots **

https://www.dropbox.com/s/xh98ut9xxv9czip/Screenshot%202017-07-05%2015.04.49.png?dl=0

Expected behavior

HMR shouldn't interfere with AngularFire2

Actual behavior

Pff, AngularFire2 borks

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