Deliver Observable read values as microtasks instead of after a timer
Les mainteneurs répondent en général sous 3 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 74/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- angular, typescript
- Domaine
- api
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
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:
ɵ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.
- Langage dominant
- TypeScript
- Étoiles
- 7.8k
- Forks
- 2.2k
- Merge moyen
- 2 j 12 h
- PR mergées (30 j)
- 24
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angularfire
-
Document the 22.0.0-rc.1 changesPeut-être pris @armando-navarro l’a pris il y a 3 jours. Ouvertecomp: docs type: chore
Difficulté 3/5 Une demi-journée Accessibilité débutants 18/100
angular/angularfire#3834 ·
Les mainteneurs répondent en général sous 3 jours
-
Accept firebase 13 in @angular/fire 22Peut-être pris @armando-navarro l’a pris il y a 3 jours. Ouvertecomp: core comp: schematics type: feature
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
angular/angularfire#3830 ·
Les mainteneurs répondent en général sous 3 jours
-
`ɵzoneWrap` ignores a handler passed as an observer object, and holds a wrapped promise forever once its injector is destroyedPeut-être pris @armando-navarro l’a pris il y a 4 jours. Ouvertecomp: app-check comp: core comp: firestore comp: remote-config comp: zones type: bug version: current (v17+)
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
angular/angularfire#3828 ·
Les mainteneurs répondent en général sous 3 jours
-
Eleven wrapped callbacks and remote-config `isSupported` hold the app unstable until something that may never happenPeut-être pris @armando-navarro l’a pris il y a 4 jours. Ouvertecomp: app-check comp: core comp: database comp: remote-config comp: ssr comp: zones type: bug version: current (v17+)
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
angular/angularfire#3826 ·
Les mainteneurs répondent en général sous 3 jours
-
comp: compat comp: firestore comp: storage type: chore
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
angular/angularfire#3822 ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de angular/angularfire
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
pingdotgg/t3code#30228 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
vfarcic/dot-agent-deck#2079 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
Broken links in the docsOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour