network-first: an eager Collection that last synced to zero rows stays loading offline
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
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- sqlite, typescript
Rechercherichtung
Start with the persisted-readiness oracle at packages/db-sqlite-persistence-core/tests/persisted-readiness-oracle.test.ts and the readiness rules in docs/guides/sqlite-persistence.md. The issue calls for deciding what evidence makes an empty restore safe and which events invalidate it; review the linked discussions #2203 and #2263 for prior design context. Done means the law and its authority are stated, generated history reaches an empty completed restore, the parent fails, the change passes, and a hostile mutant still rejects a cold empty cache.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
With initialRender: { strategy: 'network-first' }, an eager persisted Collection whose last sync produced zero rows stays loading offline. It becomes ready only when the sync adapter answers. An offline app therefore cannot show "no rows" for a Collection that is truly empty.
This is documented, intended behavior today. The guide (docs/guides/sqlite-persistence.md, "These rules keep ready meaningful") says:
An empty restore waits for the network. The Collection stays
loadinguntil the sync adapter answers, so an empty list always means "no rows". A Collection that last synced to zero rows also waits, because the restore cannot tell the two cases apart.
This issue asks whether the law should change, and how.
The problem
An empty restore has two causes that the wrapper cannot tell apart:
- A cold cache that never synced. Showing it as
readyand empty is wrong. - A cache whose last completed sync produced zero rows. Showing it as
readyand empty is correct.
To open the second case offline, the wrapper needs evidence that a sync completed and that the empty row set is that sync's result.
Earlier proposal
#2203 proposed an adapter capability, isPersistedSnapshotComplete, that certifies a completed full snapshot with durable row-set evidence. That PR also covered Electric's progressive mode. #2263 solved the progressive case with per-demand coverage and no new adapter API, so #2203 was closed. #2203 did not address the eager empty case separately, and #2263 left it out of scope.
Questions for a design
- Can the wrapper record "a full sync completed in this cache generation" itself, as #2263 does for each demand, without a new adapter API? For example, record it when the adapter calls
markReady()after a complete snapshot and the rows are durably committed. - Which events end that evidence? Candidates are a truncate, a snapshot transaction, a cache-generation rotation, and a schema reset.
- Does an eager source's
markReady()always mean a complete snapshot, or only for some adapters?
Expected evidence for a change
The persisted-readiness oracle (packages/db-sqlite-persistence-core/tests/persisted-readiness-oracle.test.ts) owns this law. A change needs a stated law and authority, a generated history that reaches an empty completed restore, RED on the parent, GREEN after the change, and a hostile mutant that opens a cold empty cache.
Related
- #2202, fixed by #2263.
- #2102, design of safe offline subset reuse.
- #2203, closed.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 4k
- Forks
- 277
- Ø Merge
- 1 T. 7 Std.
- Gemergte PRs (30 T.)
- 172
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 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
OfflineExecutor.dispose() never settles pendingTransactionPromisesEvtl. wieder frei @Claire-ovo hat das vor 7 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
TanStack/db#2254 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutEvtl. vergeben @jp-knj hat das vor 5 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
setWindow publishes the new page before its include demand settles (on-demand materialize / toArray)Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
kunchenguid/gh-axi#247 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
lidge-jun/opencodex#8101 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
effort:S P3 refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
nightscout/nocturne#3243 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
JuliusBrussee/caveman#1449 ·
Maintainer antworten meist innerhalb von 1 Tag