Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

restoreQueries and persisterGc throw on malformed persisted entries

オープン
#11,918 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@VGontier-cmd がすでに取り組んでいます。

2026年10月6日 から。

  • #11919 @VGontier-cmd による — オープン

評価

難易度
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
  1. Open the reproduction; it runs automatically.
  2. Each case stores a broken entry followed by a valid query, then calls restoreQueries() or persisterGc().
  3. 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/query のほかの issue

TanStack/query の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。