Deliver Observable read values as microtasks instead of after a timer
Maintainer antworten meist innerhalb von 3 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 74/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- angular, typescript
- Bereich
- api
Rechercherichtung
Start with src/zones.ts:82 and the ɵzoneWrap path described in the issue; check how schedulers.insideAngular is used by the Observable wrappers. Add or update tests for the timing behavior, including a wrapped Subject and the affected compat streams. Done means values reach subscribers in a microtask after the current task, not synchronously or after a timer.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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:
ɵzoneWrappipes those reads (collectionData,docData,authState,user,objectVal,listVal,fromTask, the Remote Configget*Changesstreams, 34 wrappers across the modular modules including Firestore Lite) throughobserveOn(schedulers.insideAngular).- That scheduler is built over rxjs
asyncScheduler(src/zones.ts:82), which defers withsetInterval, so each value reaches the subscriber one macrotask after Firebase handed it over. - For Firestore that is a second timer: the SDK already hands each snapshot to its callback inside a
setTimeout(0). - 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 withPromise.resolve().then, meets that requirement and delivers at the next microtask checkpoint, before any timer.
The compat layer is affected:
- The
AngularFireAuthstreamsauthState,userandcredentialdeliver through the same scheduler instance and inherit whichever timing it has. AngularFireFunctionsandAngularFireMessaginguse it only to hand over the SDK instance before their work starts, so their results are not delivered through it.- Compat Database and Firestore deliver through
schedulers.outsideAngularand are not part of this.
How to reproduce these conditions
On 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:
- When the subscriber runs, the timer has already fired, in a zone.js app and a zoneless one, in Chrome and Firefox.
- The real
collectionDataagainst the Firestore emulator and the compatauthStateagainst the Auth emulator behave the same way in Chrome. - With an
AsapSchedulerin place ofasyncScheduler, the microtask has fired and the timer has not, in every one of those runs.
Expected behavior
A value Firebase produced is handed to the subscriber as soon as the current task finishes, without an extra timer turn.
Actual behavior
Every value waits for a setInterval callback.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 7.8k
- Forks
- 2.2k
- Ø Merge
- 2 T. 12 Std.
- Gemergte PRs (30 T.)
- 24
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus angular/angularfire
-
Document the 22.0.0-rc.1 changesEvtl. vergeben @armando-navarro hat das vor 2 Tagen übernommen. Offencomp: docs type: chore
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 18/100
angular/angularfire#3834 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Accept firebase 13 in @angular/fire 22Evtl. vergeben @armando-navarro hat das vor 3 Tagen übernommen. Offencomp: core comp: schematics type: feature
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
angular/angularfire#3830 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
`ɵzoneWrap` ignores a handler passed as an observer object, and holds a wrapped promise forever once its injector is destroyedEvtl. vergeben @armando-navarro hat das vor 3 Tagen übernommen. Offencomp: app-check comp: core comp: firestore comp: remote-config comp: zones type: bug version: current (v17+)
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
angular/angularfire#3828 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Eleven wrapped callbacks and remote-config `isSupported` hold the app unstable until something that may never happenEvtl. vergeben @armando-navarro hat das vor 3 Tagen übernommen. Offencomp: app-check comp: core comp: database comp: remote-config comp: ssr comp: zones type: bug version: current (v17+)
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
angular/angularfire#3826 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
comp: compat comp: firestore comp: storage type: chore
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
angular/angularfire#3822 ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in angular/angularfire
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
oxidecomputer/skepsis#102 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
voidzero-dev/void#677 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
kunchenguid/gh-axi#247 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
lidge-jun/opencodex#8101 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag