Support persisted initialRender for Electric progressive collections
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Funcionalidade
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- database
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 4k
- Forks
- 277
- Merge médio
- 1d 6h
- PRs com merge (30d)
- 199
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/db
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
OfflineExecutor.dispose() never settles pendingTransactionPromisesTalvez já em andamento @Claire-ovo assumiu há 5 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TanStack/db#2254 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutTalvez já em andamento @jp-knj assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
Mantenedores costumam responder em até 1 dia
Todas as issues de TanStack/db
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Mantenedores costumam responder em até 2 dias
-
BeOS .json missingAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
mihaip/infinite-mac#475 ·
-
Let TypeScript accept an initial object in ReactiveDictTalvez já em andamento @yograj-vijay-yadav assumiu hoje. Abertabug good first issue help wanted workshop
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 92/100
meteor/meteor#14919 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
marmelab/atomic-crm#401 ·
Mantenedores costumam responder em até 1 dia
-
account: profile
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 5 dias