angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

All subscriptions emits on signOut()

Open linus-dev opened this issue 2 years ago • 1 comments

Hi,

I have a problem with observables in my application when a user signs out.

All HTTP requests that once has been requested gets emitted again when firebase.signOut() is called. Lets say I make two HTTP requests to my API; one to api/customers and one to api/locations. As soon as the user logs out, both of the HTTP requests are sent again.

The issue can be solved with data.getLocations().pipe(first()).subscribe(...), but why do firebase.signOut() cause this problem?

This is my code:

 getLocations() {
    this.data.getLocations().subscribe({
      next: (res) => {
        console.log('res');
        this.locations = res;
      },
      error: (err) => {
        console.log(err);
        this.locations = [];
      }
    })
  }

The console.log('res'); is shown in the console and the requests are added in the Network tab.

Im using Angular 15 and Angularfire 7.5.0.

linus-dev avatar Mar 15 '23 17:03 linus-dev

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Mar 15 '23 17:03 google-oss-bot