Disabled useLiveQuery fails SSR hydration with error 253
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript, vite
Direzione di ricerca
Start in LiveQueryObserverClient.getServerSnapshot, which calls _waitForSsrLiveQuery for a disabled query's hash even though no collection exists. Then read DbClient._setSsrStreamingEnabled, where error 253 is thrown when the stream ends early. Reproduce with the DisabledQueryRoute in examples/react/start-ssr-e2e using vite build and vite preview. Done when a disabled query hydrates with status 'disabled' and the error event no longer carries error 253.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
- I've validated the bug against the latest version of DB packages (
mainat 15d2d2d32)
Describe the bug
In a routerWithDbClient app, hydration fails when a live query is disabled, meaning its query callback returns undefined:
TanStack DB error 253 (The DB stream ended before the server-rendered query snapshot arrived.)
at DbClient._setSsrStreamingEnabled
React reports a hydration error (#422) and falls back to client rendering for the boundary. This happens in both dev and production builds.
Cause
A disabled query has no collection, so the server never captures or streams a record for it. LiveQueryObserverClient.getServerSnapshot still calls _waitForSsrLiveQuery(queryHash, true) for its hash. While the DB stream is open, the hydration read suspends. When the stream ends, it throws 253.
To Reproduce
In examples/react/start-ssr-e2e, add a route:
function DisabledQueryRoute() {
const [id] = React.useState<string | undefined>(undefined)
const { status } = useLiveQuery({
query: (q) => (id === undefined ? undefined : q.from({ todo: ssrTodoCollection })),
})
return <span>{status}</span>
}
Load the route with vite build && vite preview or with vite dev. The error event's cause chain contains error 253.
Expected behavior
A disabled query hydrates as status: 'disabled'. It should not wait for a record that the server never sends.
Additional context
Versions: @tanstack/db / @tanstack/react-db 1.0.0-rc.1.1, @tanstack/react-router-with-db 1.0.0-rc.1, React 19, Chromium.
- Lingua principale
- TypeScript
- Stelle
- 4k
- Fork
- 277
- Merge medio
- 1g 7h
- PR unite (30g)
- 191
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/db
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
OfflineExecutor.dispose() never settles pendingTransactionPromisesForse già presa @Claire-ovo l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TanStack/db#2254 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutForse già presa @jp-knj l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:auth-provider issue-rating: 🦞 diamond lobster no-stale P1
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
steipete/oracle#614 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Koenkk/zigbee-herdsman-converters#13656 ·
I maintainer di solito rispondono entro 2 giorni
-
Report: Mooz Dance SDApertacheck:passed streams:remove
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
actions/setup-node#1659 ·
I maintainer di solito rispondono entro 1 giorno