DbClient.cleanup() cleans up a live query's source before the live query, logging an error on every SSR request
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- database
Direzione di ricerca
Start by locating DbClient.cleanup() and the live query cleanup registration it processes. Read the cleanup path alongside the source-cleaned error handling, then reproduce the issue using the supplied SSR example with chained useLiveQuery calls. Done means whole-client cleanup of those queries completes without logging the source-cleaned error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
On the server, routerWithDbClient cleans up the request's DbClient once the render finishes. When one useLiveQuery reads from the collection another useLiveQuery returned (as in "Caching Intermediate Results"), every request logs:
[Live Query Error] Source collection 'live-query-2' was manually cleaned up while live query 'live-query-3' depends on it. Live queries prevent automatic GC, so this was likely a manual cleanup() call.
DbClient.cleanup() runs every registered live query cleanup at once, in creation order. The source query was created first, so it's cleaned up before the query that depends on it, and the dependent query reports an error. A single unchained live query cleans up silently.
Repro
@tanstack/db 0.15.1, @tanstack/react-db 0.5.11, React 19.3.1, Bun:
import { DbClient, DbProvider, collectionOptions, localOnlyCollectionOptions, useLiveQuery } from '@tanstack/react-db'
import { renderToString } from 'react-dom/server'
const todos = collectionOptions('todos', () =>
localOnlyCollectionOptions({ id: 'todos', getKey: (t: { id: number }) => t.id, initialData: [{ id: 1 }, { id: 2 }] }),
)
function Todos() {
const { collection: base } = useLiveQuery({ queryKey: ['base'], query: (q) => q.from({ todo: todos }) })
const { data } = useLiveQuery({ queryKey: ['page', base.id], query: (q) => q.from({ todo: base }) })
return <p>{data.length}</p>
}
const client = new DbClient()
client._setSsrServerCleanupEnabled(true) // what routerWithDbClient does on the server
renderToString(<DbProvider client={client}><Todos /></DbProvider>)
await client.cleanup() // logs the error above
Expected
A whole-client cleanup() tears the queries down without errors: either dependents before their sources, or no source-cleaned error for a query the same cleanup is about to clean up anyway.
- Lingua principale
- TypeScript
- Stelle
- 4k
- Fork
- 277
- Merge medio
- 1g 4h
- PR unite (30g)
- 212
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 4 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 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Ordered loader retains earlier requests after a newer authoritative read succeedsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
components-web-app/docs#307 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
localstack/localstack-mcp-server#112 ·
I maintainer di solito rispondono entro 1 giorno
-
area:frontend kind:bug priority:p1 ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
PhyberApex/kuroshiro#1687 ·
I maintainer di solito rispondono entro 1 giorno
-
Performance (Web Vitals) collector: LCP/FCP from background tabs are not discarded, inflating p75Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
umami-software/umami#4720 ·
I maintainer di solito rispondono entro 3 giorni