Skip to content

Commit 789897c

Browse files
fix(auth): stop beforeAuthStateChanged from holding the app unstable
AngularFire wrapped beforeAuthStateChanged so that registering the hook added a pending task, cleared only when the callback first runs. Firebase runs that callback only on a sign-in or sign-out, so for a visitor who does neither the app never became stable. Registered on the server, it failed ng build during route extraction and left server-rendered requests without a response. This restores the blockUntilFirst: false override from #3590, which #3613 dropped without comment while adding log-level overrides next to it. The callback still runs inside Angular's zone and injection context, and its returned promise still reaches Firebase, so a rejection still cancels the sign-in. A call outside an injection context now logs its per-call warning only at the verbose level, as onMessage does. Fixes #3748
1 parent a2662fe commit 789897c

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/auth/firebase.ts‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tools/build.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ ${exportedZoneWrappedFns}
177177
indexedDBLocalPersistence: null,
178178
prodErrorMap: null,
179179
multiFactor: null,
180+
// Its callback fires only on a sign-in or sign-out, so blocking would keep `ApplicationRef.isStable` false.
181+
beforeAuthStateChanged: { blockUntilFirst: false },
180182
linkWithCredential: { logLevel: LogLevel.VERBOSE },
181183
linkWithPhoneNumber: { logLevel: LogLevel.VERBOSE },
182184
linkWithPopup: { logLevel: LogLevel.VERBOSE },

0 commit comments

Comments
 (0)