Eleven wrapped callbacks and remote-config `isSupported` hold the app unstable until something that may never happen
維護者通常 3 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 48/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- angular, firebase, typescript
研究方向
Start with the ɵzoneWrap configuration and the generation rules in tools/build.ts, then compare the wrapped callbacks and remote-config isSupported with the existing onMessage and analytics or messaging entries. Check generated exports and tests for callback task handling and isSupported; done means the listed callbacks no longer block stability when their first event is not guaranteed, while callbacks still run in Angular context, and remote-config isSupported is generated with blockUntilFirst: false.
由索引模型根據 Issue 內容生成。
描述
Version info
Angular: 22.2
Firebase: 12.19.0
AngularFire: 22.0.0-rc.0, and main
Description
ɵzoneWrap registers an Angular pending task as soon as a wrapped function is passed a callback, and releases it only when that callback first runs or the returned unsubscribe is called.
That is right for onValue, onSnapshotsInSync and onAuthStateChanged, which deliver a first value on attach. Eleven wrapped calls take a callback that a normal page load may never run, in which case ApplicationRef.isStable would stay false for good:
onLogfrom@angular/fire/app: never stable until some Firebase SDK logs, which a quiet app never does. It returnsvoid, so no unsubscribe can release the task either.onTokenChangedfrom@angular/fire/app-check: never stable until a token is obtained. With the setupdocs/app-check.mdshows (noisTokenAutoRefreshEnabled), a first visit that makes no protected request never obtains one.onChildAddedfrom@angular/fire/database: never stable on an empty node. A new listener's initial events are onlychild_added, one per existing child, andvalue.onChildChanged,onChildMoved,onChildRemovedfrom@angular/fire/database: never stable until someone changes, moves or removes a child. None of them fires on attach.off(query, eventType, callback)from@angular/fire/database: never stable. It never calls the callback it is given and returnsvoid.enableLogging(fn)from@angular/fire/database: never stable until the database SDK logs something.fromRefon a child event, andstateChangesandauditTrailwith their default events, from@angular/fire/database: never stable on an empty node. They emit only on child events, so the taskpendingUntilEventregistered is never released.
isSupported from @angular/fire/remote-config is a twelfth case with a different cause:
- Its promise settles when an IndexedDB check answers, so a browser that never answers holds the app for good.
- #3613 added
isSupported: { blockUntilFirst: false }for it, matching the analytics and messaging copies, but in therxfire/remote-configblock oftools/build.ts, which exports noisSupported. The generator ignored the entry and remote-config shippedtrue. - #3759 deleted the dead entry and left the move for a follow-up.
How to reproduce these conditions
On a fresh Angular 22 app with @angular/fire@next, wrap each real function with ɵzoneWrap at true (the generated line), call it the way a constructor does, inside the Angular zone and an injection context, against the Database and Firestore emulators, and record every ApplicationRef.isStable emission:
onLog,onTokenChanged(provider with no token, no auto refresh),onChildAddedon an empty node,onChildChanged,onChildMovedandonChildRemovedon a node with three children: unstable from 0 ms, still unstable at 3 seconds, callback never ran. Same in a zone.js app and a zoneless one.onChildAddedon a node with three children,onValue,onSnapshotsInSync,onTokenChangedwith auto refresh on: unstable from 0 ms, stable again within 2 to 23 ms when the callback ran.- With
false: no task registered, and inside the callbackinject()still works and, under zone.js,NgZone.isInAngularZone()is still true.
A fresh Angular 22 SSR app that registers an onLog handler inside provideAppInitializer: with onLog imported from @angular/fire/app, ng build fails after about 30 seconds, the route extractor's timeout, with Routes extraction was aborted. TimeoutError: The operation was aborted due to timeout. With the identical file importing from firebase/app, it builds in about 2 seconds. That is the failure #3748 reported for beforeAuthStateChanged.
For isSupported: true holds the app unstable until the IndexedDB check answers, and for the whole window when indexedDB.open is stubbed to never fire. false registers no task. Inside the caller's .then, inject() throws and the zone is the one that attached the .then, at both values.
Expected behavior
A wrapped call whose first callback is not guaranteed by subscribing does not hold the application unstable, as onMessage, onRegistered, onUnregistered and beforeAuthStateChanged already do not. isSupported from @angular/fire/remote-config is wrapped like the analytics and messaging copies.
Actual behavior
All twelve are wrapped with blockUntilFirst true.
- 主要語言
- TypeScript
- 星號
- 7.8k
- 分支
- 2.2k
- 平均合併
- 2 天 14 小時
- 30 天內合併 PR
- 26
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
angular/angularfire 的其他 Issue
-
comp: compat comp: ssr comp: zones type: feature version: current (v17+)
難度 3/5 1-2 天 新手友好度 74/100
angular/angularfire#3832 ·
維護者通常 3 天內回覆
-
Accept firebase 13 in @angular/fire 22可能已有人在做 @armando-navarro 於 1 天前認領。 未關閉comp: core comp: schematics type: feature
難度 4/5 3-5 天 新手友好度 25/100
angular/angularfire#3830 ·
維護者通常 3 天內回覆
-
`ɵzoneWrap` ignores a handler passed as an observer object, and holds a wrapped promise forever once its injector is destroyed可能已有人在做 @armando-navarro 於 1 天前認領。 未關閉comp: app-check comp: core comp: firestore comp: remote-config comp: zones type: bug version: current (v17+)
難度 4/5 3-5 天 新手友好度 25/100
angular/angularfire#3828 ·
維護者通常 3 天內回覆
-
comp: compat comp: firestore comp: storage type: chore
難度 4/5 3-5 天 新手友好度 48/100
angular/angularfire#3822 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 55/100
angular/angularfire#3800 · 1 個 reaction ·
維護者通常 3 天內回覆
查看 angular/angularfire 的全部 Issue
相似的 Issue
-
bug low priority
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 66/100
laaielichter/Godotwright#81 ·
維護者通常 1 天內回覆
-
gebied: infra
難度 2/5 1-3 小時 新手友好度 72/100
VincentSmedinga/sc-heerenveen-fansite#538 ·
維護者通常 1 天內回覆
-
CI grants a token it does not need, never cancels superseded runs, and cannot fail on lint warnings未關閉good first issue help wanted type:infrastructure type:security
難度 2/5 1-3 小時 新手友好度 70/100
Open-Glassbeetle/glassbeetle#247 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆