Weird bug with Angular unit tests
維護者通常 1 天內回覆
@benjavicente 已經在處理了。
開始於 2026年10月2日。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- angular, typescript
- 領域
- frontend, testing-qa
研究方向
使用 ng test 在連結的最小範例中重現該行為,比較註解掉和未註解掉類別欄位行時的 app.ts。首先追蹤 Angular adapter 中的 fixture.whenStable() 和 query.data。當理解該行為,且預期結果已由一個聚焦的測試涵蓋時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Describe the bug
In the docs it says that in the unit tests we should await fixture.whenStable() so a query completes and we get its resulted data. It is true but if I add a class field that references to query.data the query's data becomes undefined.
Your minimal, reproducible example
https://github.com/ms-dosx86/test-when-stable
Steps to reproduce
- Run
ng test - See that the test passes
- Uncomment the commented line in
app.ts - Run the test again
- Test fails
Expected behavior
I'm not sure what's going on there but I have a feeling that creating a class field that references to query.data shouldn't cause such behaviour.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- MacOS 26.0.1 (25A362)
- Chrome 143.0.7499.193
Tanstack Query adapter
angular-query
TanStack Query version
5.90.22
TypeScript version
5.8.2
Additional context
No response
- 主要語言
- TypeScript
- 星號
- 50.5k
- 分支
- 4.2k
- 平均合併
- 8 小時 14 分鐘
- 30 天內合併 PR
- 632
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TanStack/query 的其他 Issue
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)可能重新可做 @LeonxLJX 於 53 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
TanStack/query#11358 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
useBaseQuery fetches the old query key when an <Activity> tree is revealed可能已有人在做 @lazerg 於 6 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
維護者通常 1 天內回覆
-
[query-broadcast-client-experimental] broadcastQueryClient: an `added` event overwrites a receiving query that has no data (e.g. in error) with the sender's empty state可能已有人在做 @lazerg 於 7 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 25/100
維護者通常 1 天內回覆
-
solid-query 6.0.0-rc.5: onCacheEvent throws NotReadyError during a Solid 2 (rc.14+) transition landing可能已有人在做 @UzumakiODZ 於 12 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 28/100
TanStack/query#12031 · 2 則留言 ·
維護者通常 1 天內回覆
-
Explicit gcTime schedules a GC timer during SSR, retaining the whole render in memory可能已有人在做 @AdzerKI 於 13 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 25/100
TanStack/query#12025 · 2 則留言 ·
維護者通常 1 天內回覆
相似的 Issue
-
backend refactor
難度 2/5 1-3 小時 新手友好度 73/100
NIAEFEUP/tts#927 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
callstackincubator/react-native-harness#296 ·
維護者通常 1 天內回覆
-
status:in-linear
難度 2/5 1-3 小時 新手友好度 67/100
維護者通常 1 天內回覆
-
verified
難度 2/5 1-3 小時 新手友好度 67/100
維護者通常 5 天內回覆
-
Add inputmode attribute support (forwarded to the inner input)可能重新可做 關聯的 PR 已關閉且未合併。 未關閉enhancement
難度 2/5 1-3 小時 新手友好度 68/100
Neovici/cosmoz-input#467 ·
維護者通常 1 天內回覆