Hydration error using loading state of useQuery when prefetching
I maintainer di solito rispondono entro 1 giorno
@DogPawHat ci sta già lavorando.
Dal 15/9/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia con la riproduzione StackBlitz collegata e segui il percorso del prefetch del server, dell’hydration del client e del rendering di useQuery isLoading. Leggi la issue tRPC correlata per il contesto; il lavoro è completato quando la riproduzione non produce più un errore di hydration dopo aver compilato e avviato il progetto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
If you prefetch data on the server and then use useQuery with isLoading on the client, it can lead to a hydration error.
Your minimal, reproducible example
https://stackblitz.com/~/github.com/Icestonks/react-query-trpc-test
Steps to reproduce
- Prefetch something on the server
- Hydrate it to the client
- Use
useQueryin the client, and have a loading fallback withisLoading.
Then there should come a hydration error.
Expected behavior
When first building and starting the project, we should see an hydration error. The error can also come at other times, but that's the most reliable way, to get the error to occur.
How often does this bug happen?
Sometimes
Screenshots or Videos
Platform
- OS: Windows
- Browser: Google Chrome
- Browser version: 138.0.7204.100
Tanstack Query adapter
react-query
TanStack Query version
5.82.0
TypeScript version
5.8.3
Additional context
Initially, the issue was thought to be related to tRPC, so there has been some discussion about the error over there: https://github.com/trpc/trpc/issues/6740
Would highly recommend reading some of the comments from that issue. Could maybe also give some more context.
- Lingua principale
- TypeScript
- Stelle
- 50.4k
- Fork
- 4.2k
- Merge medio
- 7h 29m
- PR unite (30g)
- 393
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/query
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TanStack/query#11358 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
solid-query: switching the queryClient accessor strands the new client's cache (subscription stays on the old observer)Forse già presa @MaNaN1803 l’ha presa 75 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TanStack/query#11106 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
restoreQueries and persisterGc throw on malformed persisted entriesForse già presa @VGontier-cmd l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
-
setQueryData: NoInfer loses discriminated-union members when spreading a narrowed updater valueForse già presa @iosayin l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TanStack/query
Issue simili
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
github/docs#46222 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
agent-ready area: config area: skills type: chore upstream: brain-kit
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
enhancement priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug escritorio mapa
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
marcosferr/reporte-ciudadano#4 · 1 commento ·
-
area: material/sort gemini-triaged needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
angular/components#33933 ·
I maintainer di solito rispondono entro 1 giorno