A live query's preload on an on-demand collection waits for any persisting optimistic transaction
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 12/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- databases
Rechercherichtung
The hang comes from commitNextPendingTransactionBatch in packages/db/src/collection/state.ts, which holds accepted sync transactions while an optimistic one persists, and from whenSyncAccepted in packages/db/src/sync-receipt.ts. Start with the repro in packages/query-db-collection/tests/refetch-ordered-prefix-oracle.test.ts. Done means a focused Collection-lifecycle test where a new live query's preload settles during a held mutation, and the harness workaround is removed. The issue itself says whether this needs a design decision first.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
While an optimistic transaction persists on an on-demand Query Collection, a new live query on that Collection does not become ready. Its preload() waits until the transaction settles. This happens even when the transaction touches rows the new query does not read.
Reproduction
Found while #2154 added an optimistic-hold dimension to packages/query-db-collection/tests/refetch-ordered-prefix-oracle.test.ts.
- Create an on-demand Query Collection with an
onUpdate(oronDelete) handler that waits on a promise the test controls. - Load some rows, then call
collection.update(id, ...)on one loaded row. The handler now waits. - Create a second live query on the same Collection, for example
where id = <another id>, and callpreload(). - The preload does not settle until the handler's promise resolves. Without step 2, it settles at once.
Seven variants all hang at step 3. They cover an update or a delete hold, the same row or another row, and a backend change first or not.
Why
commitNextPendingTransactionBatchholds every accepted sync transaction back while an optimistic transaction persists (packages/db/src/collection/state.ts).- Collection readiness and mutation-handler writes wait for acceptance (
whenSyncAccepted,packages/db/src/sync-receipt.ts). - A
loadSubsetload settles only when its rows are visible, so a load during the hold waits for the transaction.
Is this intended?
Probably not as a product promise: a slow mutation (offline, slow server) delays every live query that opens during it. It is the same mechanism as #2169, where held sync rows hide an optimistic removal. It may need the same law decision: which observations may wait for a persisting transaction.
Suggested witness
A focused Collection-lifecycle witness: a held mutation, then a new live query's preload must settle. Then remove the harness workaround in the query-db refetch oracle, which today defers awaiting preload() until the hold's release.
This issue was written by Isaac.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.9k
- Forks
- 272
- Ø Merge
- 22 Std. 54 Min.
- Gemergte PRs (30 T.)
- 236
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus TanStack/db
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 12/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 8/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 5/100
TanStack/db#2186 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Endpoint links in the tag operations list are below the 24px target sizeEvtl. vergeben @AdzerKI hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
ai-driven-qa bug Minor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
linagora/twake-tasks#435 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug domain: database priority: p1 Stellar Wave
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
StellarState/SS-backend#632 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
A2A audit timestamps end in +00:00Z (invalid ISO 8601)Evtl. vergeben @O1sumitkumar hat das heute übernommen. Offenbug good first issue help wanted python
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
`cf complete zsh >> .zshrc` fails on vanilla zshEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
cloudflare/cf#340 ·
Maintainer antworten meist innerhalb von 1 Tag