network-first: an eager Collection that last synced to zero rows stays loading offline
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- sqlite, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 4k
- Forks
- 277
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 172
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/db
-
`Collection.currentStateAsChanges` JSDoc examples don’t match `CurrentStateAsChangesOptions`Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
OfflineExecutor.dispose() never settles pendingTransactionPromisesQuizá libre de nuevo @Claire-ovo la tomó hace 7 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TanStack/db#2254 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutPosiblemente ocupada @jp-knj la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
setWindow publishes the new page before its include demand settles (on-demand materialize / toArray)Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/db
Issues similares
-
[Bug]: Fix for unicode filenamesAbierto🐛 bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
LibreChat-AI/LibreChat#17733 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
TypeStrong/typedoc#3150 ·
-
accessibility bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Normalize image-source MIME types before SVG dispatchPosiblemente ocupada @HarsH-1877 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
tscircuit/image-utils#58 · 1 comentario ·
-
Add API: BlockVectra Data APIAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
Los mantenedores suelen responder en 2 días