Title: Deliver Observable read values as microtasks instead of after a timer · Issue #3832 · angular/angularfire · GitHub
Open Graph Title: Deliver Observable read values as microtasks instead of after a timer · Issue #3832 · angular/angularfire
X Title: Deliver Observable read values as microtasks instead of after a timer · Issue #3832 · angular/angularfire
Description: Version info Angular: 22.2 Firebase: 12.19.0 AngularFire: 22.0.0-rc.0, and main Description Every Observable-returning read waits one timer turn before its subscriber sees a value: ɵzoneWrap pipes those reads (collectionData, docData, au...
Open Graph Description: Version info Angular: 22.2 Firebase: 12.19.0 AngularFire: 22.0.0-rc.0, and main Description Every Observable-returning read waits one timer turn before its subscriber sees a value: ɵzoneWrap pipes ...
X Description: Version info Angular: 22.2 Firebase: 12.19.0 AngularFire: 22.0.0-rc.0, and main Description Every Observable-returning read waits one timer turn before its subscriber sees a value: ɵzoneWrap pipes ...
Opengraph URL: https://github.com/angular/angularfire/issues/3832
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deliver Observable read values as microtasks instead of after a timer","articleBody":"\n### Version info\n\n**Angular:** 22.2\n\n**Firebase:** 12.19.0\n\n**AngularFire:** 22.0.0-rc.0, and `main`\n\n### Description\n\nEvery Observable-returning read waits one timer turn before its subscriber sees a value:\n\n- `ɵzoneWrap` pipes those reads (`collectionData`, `docData`, `authState`, `user`, `objectVal`, `listVal`, `fromTask`, the Remote Config `get*Changes` streams, 34 wrappers across the modular modules including Firestore Lite) through `observeOn(schedulers.insideAngular)`.\n- That scheduler is built over rxjs `asyncScheduler` ([`src/zones.ts:82`](https://github.com/angular/angularfire/blob/398fef4/src/zones.ts#L82)), which defers with `setInterval`, so each value reaches the subscriber one macrotask after Firebase handed it over.\n- For Firestore that is a second timer: the SDK already hands each snapshot to its callback inside a `setTimeout(0)`.\n- The scheduler came in with #2243 (merged 2020), and the comment that PR added requires that emissions are never synchronous. rxjs's `AsapScheduler`, which defers with `Promise.resolve().then`, meets that requirement and delivers at the next microtask checkpoint, before any timer.\n\nThe compat layer is affected:\n\n- The `AngularFireAuth` streams `authState`, `user` and `credential` deliver through the same scheduler instance and inherit whichever timing it has.\n- `AngularFireFunctions` and `AngularFireMessaging` use it only to hand over the SDK instance before their work starts, so their results are not delivered through it.\n- Compat Database and Firestore deliver through `schedulers.outsideAngular` and are not part of this.\n\n### How to reproduce these conditions\n\nOn a fresh Angular 22.2 app with `@angular/fire@next`, wrap a `Subject` with the real `ɵzoneWrap`, subscribe, and at the moment the source emits register a `setTimeout(0)` and a `queueMicrotask`:\n\n- When the subscriber runs, the timer has already fired, in a zone.js app and a zoneless one, in Chrome and Firefox.\n- The real `collectionData` against the Firestore emulator and the compat `authState` against the Auth emulator behave the same way in Chrome.\n- With an `AsapScheduler` in place of `asyncScheduler`, the microtask has fired and the timer has not, in every one of those runs.\n\n### Expected behavior\n\nA value Firebase produced is handed to the subscriber as soon as the current task finishes, without an extra timer turn.\n\n### Actual behavior\n\nEvery value waits for a `setInterval` callback.\n\n","author":{"url":"https://github.com/armando-navarro","@type":"Person","name":"armando-navarro"},"datePublished":"2026-10-30T17:54:12Z","url":"https://github.com/angular/angularfire/issues/3832"}
| 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 | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:00010682-d5e5-59bd-36bc-69ac34ea7c25 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA42:16DC03:309A713:40601CE:6B035C25 |
| html-safe-nonce | d94db46459a23de0e4d8ba7983a0fe47e4ad060994a6860804852f770445de20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTQyOjE2REMwMzozMDlBNzEzOjQwNjAxQ0U6NkIwMzVDMjUiLCJ2aXNpdG9yX2lkIjoiODE4MDA0NDQ3MTUwNjAwMDkzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | aed0242a37c3d24e939c125e8022df510668ec73862882e8f088379aed4d37c7 |
| hovercard-subject-tag | issue:6124266753 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/angular/angularfire/3832/issue_layout |
| twitter:image | https://opengraph.githubassets.com/704827fbcd21e409a559284e1684e2caa216e92f67b14ec718057c6bb6bbfc05/angular/angularfire/issues/3832 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/704827fbcd21e409a559284e1684e2caa216e92f67b14ec718057c6bb6bbfc05/angular/angularfire/issues/3832 |
| og:image:alt | Version info Angular: 22.2 Firebase: 12.19.0 AngularFire: 22.0.0-rc.0, and main Description Every Observable-returning read waits one timer turn before its subscriber sees a value: ɵzoneWrap pipes ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | armando-navarro |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| 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 |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width