Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Support persisted initialRender for Electric progressive collections

Aperta
#2,202 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Jose10go ci sta già lavorando.

Dal 20/10/2026.

  • #2203 di @Jose10go — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
database

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
3.9k
Fork
277
Merge medio
17h 54m
PR unite (30g)
226

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/db

Tutte le issue di TanStack/db

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.