Support persisted initialRender for Electric progressive collections
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- database
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 3.9k
- 派生
- 277
- 平均合并
- 18 小时 8 分钟
- 30 天内合并 PR
- 219
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/db 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 22/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 12/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
维护者通常 1 天内回复
相似的 Issue
-
[BUG] rag: sentence content can cross the reported sentence boundaries可能已有人在做 @LJK-ikun 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URI未关闭
难度 1/5 1 小时以内 新手友好度 88/100
platformatic/mcp#361 ·
维护者通常 1 天内回复
-
frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Push: sem service worker ou sem VAPID, o interruptor de Notificações fica ligado sem avisar nada未关闭
难度 2/5 1-3 小时 新手友好度 76/100
melgarafael/DeskcommCRM#3164 ·
维护者通常 1 天内回复