0

I'm having a really odd problem with my app, localhost seems to work fine for me. But anytime I use ng-build, or ng-build --prod and deploy to my firebase I have issues with retrieving data. Sometimes it will return data like when i load up on my iPad but more often than not it does not find the data.

enter image description here

 this.as.userObservable()
  .filter(res => res)
  .subscribe(user => {

    if (this.selectedSeriesSubscription) { this.selectedSeriesSubscription.unsubscribe() }

    if (user.selectedSeries) {
      this.getSelectedSeries(user.selectedSeries)
    } else {
      this.fb.settings().valueChanges().take(1)
        .subscribe(settings => {
          console.log(settings)
          this.getSelectedSeries(settings['defaultSeries'])
        })
    }
  });


 // SETTINGS - this.fb ^^^
 settings() {
  return this.afs.doc<any>(`global/settings`);
 }

That is the code that is firing, it loads the user and user data before this fine though?

I'm using angularfire2, angular 4. Is this only happening because of my build process?

Any ideas would be appreciated.

Ryann Galea
  • 307
  • 3
  • 18
  • Angularfire2 tag is required here Frank – Ryann Galea Nov 02 '17 at 21:42
  • After some time testing, it seems that the .take(1) is working, and receiving the empty value which I am getting, for some unknown reason an empty value. If I remove the '.take(1)' it works fine it seems, I'm not sure why it receives an empty string first back from that doc call. I think when it's hosted it is getting an inconsistent value because it would work intermittently. It would actually work on my production site sometimes, and sometimes not. It is also to be noted it is being pushed to the dev hosting, but using the prod DB on another firebase. – Ryann Galea Nov 04 '17 at 02:43

0 Answers0