Title: fix(auth): stop beforeAuthStateChanged from holding the app unstable by armando-navarro · Pull Request #3770 · angular/angularfire · GitHub
Open Graph Title: fix(auth): stop beforeAuthStateChanged from holding the app unstable by armando-navarro · Pull Request #3770 · angular/angularfire
X Title: fix(auth): stop beforeAuthStateChanged from holding the app unstable by armando-navarro · Pull Request #3770 · angular/angularfire
Description: Fixes #3748 Restores beforeAuthStateChanged: { blockUntilFirst: false }, which #3590 added and #3613 dropped without comment. Changes @angular/fire/auth wraps beforeAuthStateChanged with blockUntilFirst set to true, so registering the hook adds a pending task that clears only when the callback first runs. Firebase runs this callback only on a sign-in or sign-out, so for a visitor who does neither, the app never becomes stable. In the browser, ApplicationRef.whenStable() never resolves. When the hook is also registered on the server, ng build fails during route extraction, and a server that renders per request never responds. With the override, 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. One other difference: a call outside an injection context now logs its per-call warning only at the verbose log level, as onMessage does. #3590 added the override with the note "beforeAuthStateChanged should not block". #3613 removed it at the spot where it added log-level overrides, and none of the issues #3613 fixed involve this function, so the removal looks accidental. docs/auth.md and the sample keep importing beforeAuthStateChanged from firebase/auth until a release carries this fix. Verification On an Angular 21.2 server-rendered app, comparing 21.0.0-rc.1 with a build of this branch: Hook registered on the server: ng build on rc.1 fails after 34 seconds with Routes extraction was aborted. TimeoutError. With this branch it succeeds. Hook registered on the server only while answering a request, with every route rendered per request: each request to rc.1 got no response within 60 seconds. With this branch, each returned a server-rendered page in under 30 milliseconds. The cookie sync from docs/auth.md, which registers the hook only in the browser: on rc.1 the app did not become stable within 10 seconds. With this branch it became stable after 25 milliseconds. npm run test:node: 331 specs, 0 failures. npm run test:chrome-headless: 107 passed, 48 skipped.
Open Graph Description: Fixes #3748 Restores beforeAuthStateChanged: { blockUntilFirst: false }, which #3590 added and #3613 dropped without comment. Changes @angular/fire/auth wraps beforeAuthStateChanged with blockUnti...
X Description: Fixes #3748 Restores beforeAuthStateChanged: { blockUntilFirst: false }, which #3590 added and #3613 dropped without comment. Changes @angular/fire/auth wraps beforeAuthStateChanged with blockUnti...
Opengraph URL: https://github.com/angular/angularfire/pull/3770
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a79930b5-b51a-ea16-8b06-b9b01f6b293d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B24A:2C4C9:24B65C8:3074459:6B036984 |
| html-safe-nonce | 08ebf908df64ba089481981b1342209e6032f026d9e26a8bb0fbc64d09b8d1ee |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjRBOjJDNEM5OjI0QjY1Qzg6MzA3NDQ1OTo2QjAzNjk4NCIsInZpc2l0b3JfaWQiOiI2NjUxNzIxMzg5MDQ2OTgzMDQ0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ca1399c1f117675675700a8f7c0d0f03575ba9c1937aff457884a156eb5fb36b |
| hovercard-subject-tag | pull_request:4633628008 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/angular/angularfire/pull/3770/files |
| twitter:image | https://avatars.githubusercontent.com/u/13904589?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/13904589?s=400&v=4 |
| og:image:alt | Fixes #3748 Restores beforeAuthStateChanged: { blockUntilFirst: false }, which #3590 added and #3613 dropped without comment. Changes @angular/fire/auth wraps beforeAuthStateChanged with blockUnti... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/angular/angularfire git https://github.com/angular/angularfire.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 49453413 |
| octolytics-dimension-repository_nwo | angular/angularfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49453413 |
| octolytics-dimension-repository_network_root_nwo | angular/angularfire |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width