Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

restoreQueries and persisterGc throw on malformed persisted entries

Aperta
#11,918 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@VGontier-cmd ci sta già lavorando.

Dal 6/10/2026.

  • #11919 di @VGontier-cmd — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
50.4k
Fork
4.2k
Merge medio
7h 29m
PR unite (30g)
393

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/query

Tutte le issue di TanStack/query

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.