Remove a callback read's pending task right after the callback instead of one `setTimeout(fn, 0)` later
Les mainteneurs répondent en général sous 3 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 84/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- angular, firebase, typescript
- Domaine
- backend, performance
Piste de recherche
Lisez src/zones.ts, en particulier l’encapsulation du callback et la suppression des tâches en attente autour des lignes 123, 153 et 190. Suivez les chemins du premier callback et de la désinscription. Vérifiez ensuite comment chacun supprime la tâche et comment le callback se comporte s’il lève une exception. Le travail est terminé lorsque la tâche est supprimée immédiatement après le premier callback ou lors de la désinscription, sans temporisateur, et que l’ordre des marqueurs décrit est respecté.
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 callback-taking read that holds a pending task keeps it one setTimeout(fn, 0) delay longer than it needs to:
ɵzoneWrapregisters a pending task when a function wrapped withblockUntilFirsttrue, such asonSnapshot,onAuthStateChangedoronValue, is handed a callback, and removes it withsetTimeout(taskDone, 0)scheduled right before the first callback runs (src/zones.ts:123) and again when the returned unsubscribe is called (:190).- So
ApplicationRef.isStablecan turn true only after that timer callback has run, one macrotask after the first value arrived. The comment next to the wrapping call,// TODO create a microtask to track callback functions(:153), asks for a microtask in its place. - #3833 moved the Observable-returning reads off their timer. The callback reads are the remaining branch.
- Removing the task in a
finallyright after the callback body needs no timer and keeps a throwing callback from leaving its task behind.
How to reproduce these conditions
On a fresh Angular 22.2 app with @angular/fire@next, wrap a callback-taking function with the real ɵzoneWrap, invoke the callback from a setTimeout(fn, 0) outside Angular, and inside that same setTimeout callback, before invoking it, register a second setTimeout(fn, 0) and a queueMicrotask as markers. Observe the moment the wrapper calls the remover function that PendingTasks.add() returned:
- The marker
setTimeoutcallback has already run, in a zone.js app and a zoneless one, in Chrome and Firefox, for the first callback and for unsubscribe. - With the task removed in a
finallyafter the callback body, the remover is called before either marker has run, in every one of those runs. - The real
onSnapshotagainst the Firestore emulator, with the markers registered by a raw SDK listener attached first to the same document, reads the same way: the remover runs after the markersetTimeoutcallback today, and before it with the change.
Expected behavior
A callback read's pending task is removed as soon as its first callback has run, or as soon as it is unsubscribed.
Actual behavior
The task is removed one setTimeout(fn, 0) delay later.
- Langage dominant
- TypeScript
- Étoiles
- 7.8k
- Forks
- 2.2k
- Merge moyen
- 2 j 21 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 4 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
-
`ɵ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 5 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
-
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
-
Difficulté 2/5 1-3 heures Accessibilité débutants 55/100
angular/angularfire#3800 · 1 réaction ·
Les mainteneurs répondent en général sous 3 jours
-
Use `TransferState` to hand server-rendered Firestore data to the browser, instead of reading every document twicePeut-être à nouveau libre @armando-navarro l’a pris il y a 65 jours, et aucune pull request n’est ouverte. Ouvertecomp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de angular/angularfire
Issues similaires
-
[fullsend] E2E: scorecard — filecheck GitLab entity metrics unavailable due to initialDelay timingOuvertee2e-failure ready-to-code
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
redhat-developer/rhdh-plugin-export-overlays#4698 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
devswha/herdr-web-ui#2884 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
b:minor bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
software-mansion/argent#1771 ·
Les mainteneurs répondent en général sous 1 jour
-
Resources: New palettes of XiamenPeut-être pris @rmt-svc l’a pris aujourd’hui. Ouverteresources
Difficulté 1/5 1-3 heures Accessibilité débutants 74/100
railmapgen/rmg-palette#2491 ·
Les mainteneurs répondent en général sous 4 jours