Remove a callback read's pending task right after the callback instead of one `setTimeout(fn, 0)` later
Mantenedores costumam responder em até 3 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 84/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, firebase, typescript
- Domínio
- backend, performance
Direção de pesquisa
Leia src/zones.ts, especialmente o encapsulamento do callback e a remoção de tarefas pendentes por volta das linhas 123, 153 e 190. Acompanhe os caminhos do primeiro callback e do cancelamento da inscrição. Em seguida, verifique como cada um remove a tarefa e como o callback se comporta se lançar um erro. O trabalho estará concluído quando a tarefa for removida imediatamente após o primeiro callback ou no cancelamento da inscrição, sem temporizador, e a ordem de marcadores descrita for mantida.
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 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.
- Linguagem predominante
- TypeScript
- Estrelas
- 7.8k
- Forks
- 2.2k
- Merge médio
- 2d 21h
- 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á 5 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
-
`ɵ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á 6 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
-
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
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 55/100
angular/angularfire#3800 · 1 reação ·
Mantenedores costumam responder em até 3 dias
-
Use `TransferState` to hand server-rendered Firestore data to the browser, instead of reading every document twiceTalvez livre de novo @armando-navarro assumiu há 65 dias e não há nenhum pull request aberto. Abertacomp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 1 responsável ·
Mantenedores costumam responder em até 3 dias
Todas as issues de angular/angularfire
Issues semelhantes
-
cloudflare-cache-binding: `unstorage://` keys are rejected by the Cache API, cache never storesAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 2 dias
-
desktop: pasted image breaks and send fails with "Failed to fetch" after the clipboard temp file is deletedTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertareproduced
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
anomalyco/opencode#62052 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
strapi/design-system#2084 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia