Query keys with object property set to undefined are not considered equal to missing property during invalidation
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
リンクされた CodeSandbox の再現から始め、文書化されている query-key の決定論的な動作と、欠落しているオブジェクトプロパティおよび undefined のオブジェクトプロパティに対する無効化の結果を比較します。query-key のハッシュ処理と無効化のエントリポイントを追跡し、その後、再現環境で両方のクエリが同じレコードを無効化することを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Query keys with object property set to undefined are not considered equal to missing property. Based on the docs, it should be the same: https://react-query.tanstack.com/guides/query-keys#query-keys-are-hashed-deterministically
Your minimal, reproducible example
https://codesandbox.io/s/react-query-trz8sx?file=/src/App.tsx
Steps to reproduce
- Open the codesandbox link
- Show codesandbox console
- There are two queries rendered, the first fetch all items, and the second fetch filtered ones.
- You can see two buttons with invalidation hooks. The first one invalidates both queries, the second one invalidates only non-filtered results. See the console for refetch logs.
Expected behavior
I expect both keys should invalidate the same records no matter of filter: undefined as mentioned in react-query docs.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
macOS v12.4
Chrome 103
react-query version
Both v3.39.1 and v4.0.0-beta.23
TypeScript version
v4.7.3
Additional context
No response
- 主要言語
- TypeScript
- スター
- 50.4k
- フォーク
- 4.2k
- 平均マージ
- 7時間 29分
- マージ済み PR(30日)
- 393
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/query のほかの issue
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
TanStack/query#11358 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
solid-query: switching the queryClient accessor strands the new client's cache (subscription stays on the old observer)対応中かも @MaNaN1803 が 75 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
TanStack/query#11106 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
restoreQueries and persisterGc throw on malformed persisted entries対応中かも @VGontier-cmd が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
setQueryData: NoInfer loses discriminated-union members when spreading a narrowed updater value対応中かも @iosayin が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
github/docs#46222 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent-ready area: config area: skills type: chore upstream: brain-kit
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
enhancement priority:low ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug escritorio mapa
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
marcosferr/reporte-ciudadano#4 · コメント 1 件 ·
-
area: material/sort gemini-triaged needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
angular/components#33933 ·
メンテナーはふだん 1 日以内に返信