Disabled useLiveQuery fails SSR hydration with error 253
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript, vite
Hướng nghiên cứu
Start in LiveQueryObserverClient.getServerSnapshot, which calls _waitForSsrLiveQuery for a disabled query's hash even though no collection exists. Then read DbClient._setSsrStreamingEnabled, where error 253 is thrown when the stream ends early. Reproduce with the DisabledQueryRoute in examples/react/start-ssr-e2e using vite build and vite preview. Done when a disabled query hydrates with status 'disabled' and the error event no longer carries error 253.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- I've validated the bug against the latest version of DB packages (
mainat 15d2d2d32)
Describe the bug
In a routerWithDbClient app, hydration fails when a live query is disabled, meaning its query callback returns undefined:
TanStack DB error 253 (The DB stream ended before the server-rendered query snapshot arrived.)
at DbClient._setSsrStreamingEnabled
React reports a hydration error (#422) and falls back to client rendering for the boundary. This happens in both dev and production builds.
Cause
A disabled query has no collection, so the server never captures or streams a record for it. LiveQueryObserverClient.getServerSnapshot still calls _waitForSsrLiveQuery(queryHash, true) for its hash. While the DB stream is open, the hydration read suspends. When the stream ends, it throws 253.
To Reproduce
In examples/react/start-ssr-e2e, add a route:
function DisabledQueryRoute() {
const [id] = React.useState<string | undefined>(undefined)
const { status } = useLiveQuery({
query: (q) => (id === undefined ? undefined : q.from({ todo: ssrTodoCollection })),
})
return <span>{status}</span>
}
Load the route with vite build && vite preview or with vite dev. The error event's cause chain contains error 253.
Expected behavior
A disabled query hydrates as status: 'disabled'. It should not wait for a record that the server never sends.
Additional context
Versions: @tanstack/db / @tanstack/react-db 1.0.0-rc.1.1, @tanstack/react-router-with-db 1.0.0-rc.1, React 19, Chromium.
- Ngôn ngữ chính
- TypeScript
- Star
- 4k
- Fork
- 277
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 191
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/db
-
`Collection.currentStateAsChanges` JSDoc examples don’t match `CurrentStateAsChangesOptions`Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
OfflineExecutor.dispose() never settles pendingTransactionPromisesCó thể đã có người làm @Claire-ovo đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TanStack/db#2254 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutCó thể đã có người làm @jp-knj đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NousResearch/hermes-agent#147433 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage🔍
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Dokploy/dokploy#5836 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
guards: accept readonly arrays (and other array-likes) in isEmpty / hasElements / safeLengthĐang mởenhancement tech debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ehmpathy/rhachet-roles-bhrain#739 ·
Maintainer thường phản hồi trong vòng 1 ngày