restoreQueries and persisterGc throw on malformed persisted entries
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- backend
調査の方向性
Start by locating experimental_createQueryPersister and the implementations of restoreQueries() and persisterGc(); compare how they handle invalid JSON with parsed values such as null or {}. Run the reproduction linked in the issue and relevant persister tests. Done means malformed entries are removed without throwing, remaining valid queries are processed, and valid query data of null still restores correctly.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When using experimental_createQueryPersister, restoreQueries() throws if a stored entry contains "null", "{}" or '{"state":null}'. The entry stays in storage and the next valid query is not restored.
persisterGc() also throws on these entries.
With invalid JSON like "not-json{", the entry is removed and processing continues. I would expect the same behavior for these values.
Your minimal, reproducible example
https://stackblitz.com/edit/bqs8bszm?file=index.js
Steps to reproduce
- Open the reproduction; it runs automatically.
- Each case stores a broken entry followed by a valid query, then calls restoreQueries() or persisterGc().
- The invalid JSON cases pass, but "null", "{}" and '{"state":null}' cause a TypeError. For restoreQueries(), the next valid query is not restored.
Expected behavior
The malformed entry should be removed without throwing, and processing should continue with the remaining entries.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: macOS 27.0
- Browser: Chromium 154.0.8037.98 (verified with Playwright)
Tanstack Query adapter
vanilla
TanStack Query version
5.104.1 for both @tanstack/query-core and @tanstack/query-persist-client-core
TypeScript version
No response
Additional context
The valid query in the reproduction has null as its data. This is intentional: null query data should still be restored correctly.
- 主要言語
- 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 が 76 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
TanStack/query#11106 · コメント 1 件 ·
メンテナーはふだん 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 日以内に返信
-
setQueryData updater loses discriminated-union fields when spreading inferred NoInfer data対応中かも @boriskozak が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
TanStack/query#11794 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
[Bug] remember() with special characters in namespace hangs until timeout instead of returning 400オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
MystenLabs/MemWal#1133 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug user-priority/P2
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Effect-TS/effect#8881 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信