Deliver Observable read values as microtasks instead of after a timer
Mantenedores costumam responder em até 3 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 74/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, typescript
- Domínio
- api
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 7.8k
- Forks
- 2.2k
- Merge médio
- 2d 12h
- PRs com merge (30d)
- 24
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de angular/angularfire
-
Document the 22.0.0-rc.1 changesTalvez já em andamento @armando-navarro assumiu há 2 dias. Abertacomp: docs type: chore
Dificuldade 3/5 Meio dia Facilidade para iniciantes 18/100
angular/angularfire#3834 ·
Mantenedores costumam responder em até 3 dias
-
Accept firebase 13 in @angular/fire 22Talvez já em andamento @armando-navarro assumiu há 2 dias. Abertacomp: core comp: schematics type: feature
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
angular/angularfire#3830 ·
Mantenedores costumam responder em até 3 dias
-
`ɵzoneWrap` ignores a handler passed as an observer object, and holds a wrapped promise forever once its injector is destroyedTalvez já em andamento @armando-navarro assumiu há 2 dias. Abertacomp: app-check comp: core comp: firestore comp: remote-config comp: zones type: bug version: current (v17+)
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
angular/angularfire#3828 ·
Mantenedores costumam responder em até 3 dias
-
Eleven wrapped callbacks and remote-config `isSupported` hold the app unstable until something that may never happenTalvez já em andamento @armando-navarro assumiu há 3 dias. Abertacomp: app-check comp: core comp: database comp: remote-config comp: ssr comp: zones type: bug version: current (v17+)
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
angular/angularfire#3826 ·
Mantenedores costumam responder em até 3 dias
-
comp: compat comp: firestore comp: storage type: chore
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
angular/angularfire#3822 ·
Mantenedores costumam responder em até 3 dias
Todas as issues de angular/angularfire
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
JuliusBrussee/caveman#1449 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
linagora/twake-calendar-frontend#1924 ·
Mantenedores costumam responder em até 1 dia
-
Add: Class TV ModaAbertacheck:passed streams:add
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
libnativeapi/nativeapi#21 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
GiganticMinecraft/seichi-playguide#183 ·
Mantenedores costumam responder em até 1 dia