angular / angular/angularfire

Two consecutive `subscribe` calls on the Observable created by `authState()` cause Angular app to never become stable.

Open
#3,548 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.8k
Forks
2.2k
Avg merge
22h 28m
Merged PRs (30d)
6

Description

### Version info

**Angular:** 18.0.3

**Firebase:** 10.12.2

**AngularFire:** 18.0.1

### How to reproduce these conditions

**Failing test unit, Stackblitz demonstrating the problem**

Stackblitz example with the problem: https://stackblitz.com/edit/stackblitz-starters-zfidzt?file=src%2Fmain.ts

**Steps to set up and reproduce**

- Open Stackblitz reproduction
- Check the console, and see that the `ApplicationRef.isStable` never emits true

### Debug output

**Errors in the JavaScript console**

message: `isStable: true` is expected, but it never comes
![angular-fire-stability-example](https://github.com/angular/angularfire/assets/72603663/0672130f-9efe-4ff9-9c0c-923772eeab30)

### Expected behavior

`ApplicationRef.isStable` emits `true` after application start.
### Actual behavior

`ApplicationRef.isStable` never emits `true`, if two consecutive `subscribe` calls on the Observable created by `authState()` are made.

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction, especially src/main.ts, and reproduce the two consecutive subscribe calls on authState(). Observe ApplicationRef.isStable and compare the result with the expected true emission after application start; done means the application becomes stable in this reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, firebase, typescript
Domain
authentication, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.