Support persisted initialRender for Electric progressive collections
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- database
Rechercherichtung
Start with the network-first validation in @tanstack/db-sqlite-persistence-core and trace how @tanstack/electric-db-collection maps progressive sync mode to on-demand. Check the persistence and Electric collection tests for initial rendering and restored snapshots. Done means the reproduction no longer throws and a previously completed persisted snapshot can render while network synchronization continues.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description:
Persisted progressive electric collections should render its cached data after a hard refresh while network sync continues.
initialRender: {
strategy: 'network-first',
networkTimeoutMs: 0,
}
This throws for syncMode: 'progressive' because Electric translates it to 'on-demand', which the persistence wrapper rejects.
There is a documented restriction for on-demand collections. However, progressive collections eventually complete a full initial sync, so a previously completed, persisted snapshot should support this fallback.
Minimal reproduction
Versions: @tanstack/[email protected], @tanstack/[email protected].
Run this as an .mjs file with Node. No React, database, or running Electric server is needed to reproduce the configuration error.
import { electricCollectionOptions } from '@tanstack/electric-db-collection'
import { persistedCollectionOptions } from '@tanstack/db-sqlite-persistence-core'
persistedCollectionOptions({
...electricCollectionOptions({
id: 'todos',
syncMode: 'progressive',
getKey: row => row.id,
shapeOptions: {
url: 'http://localhost:3000/v1/shape',
params: { table: 'todos' },
},
}),
persistence: {}, // Placeholder: throws before accessing persistence.
initialRender: {
strategy: 'network-first',
networkTimeoutMs: 0,
},
})
Produce Error: network-first initial rendering requires eager persistence syncMode
Expected behavior
For progressive collections with a previously completed persisted snapshot, allow initial rendering after local restoration, while network synchronization continues.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.9k
- Forks
- 277
- Ø Merge
- 17 Std. 54 Min.
- Gemergte PRs (30 T.)
- 226
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 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
Maintainer antworten meist innerhalb von 1 Tag
-
SQLite persistence: a sync transaction whose durable write fails still changes the public CollectionOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
cursor/community-plugins#465 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
vetro-protocol/vetro-monorepo#978 ·
Maintainer antworten meist innerhalb von 1 Tag
-
ai-generated bug category:security effort:s priority:p3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
LanternOps/breeze#9697 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
maniator/verticopolis#1303 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
components-web-app/docs#297 ·