A live query's preload on an on-demand collection waits for any persisting optimistic transaction
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 12/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- databases
Hướng nghiên cứu
The hang comes from commitNextPendingTransactionBatch in packages/db/src/collection/state.ts, which holds accepted sync transactions while an optimistic one persists, and from whenSyncAccepted in packages/db/src/sync-receipt.ts. Start with the repro in packages/query-db-collection/tests/refetch-ordered-prefix-oracle.test.ts. Done means a focused Collection-lifecycle test where a new live query's preload settles during a held mutation, and the harness workaround is removed. The issue itself says whether this needs a design decision first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
While an optimistic transaction persists on an on-demand Query Collection, a new live query on that Collection does not become ready. Its preload() waits until the transaction settles. This happens even when the transaction touches rows the new query does not read.
Reproduction
Found while #2154 added an optimistic-hold dimension to packages/query-db-collection/tests/refetch-ordered-prefix-oracle.test.ts.
- Create an on-demand Query Collection with an
onUpdate(oronDelete) handler that waits on a promise the test controls. - Load some rows, then call
collection.update(id, ...)on one loaded row. The handler now waits. - Create a second live query on the same Collection, for example
where id = <another id>, and callpreload(). - The preload does not settle until the handler's promise resolves. Without step 2, it settles at once.
Seven variants all hang at step 3. They cover an update or a delete hold, the same row or another row, and a backend change first or not.
Why
commitNextPendingTransactionBatchholds every accepted sync transaction back while an optimistic transaction persists (packages/db/src/collection/state.ts).- Collection readiness and mutation-handler writes wait for acceptance (
whenSyncAccepted,packages/db/src/sync-receipt.ts). - A
loadSubsetload settles only when its rows are visible, so a load during the hold waits for the transaction.
Is this intended?
Probably not as a product promise: a slow mutation (offline, slow server) delays every live query that opens during it. It is the same mechanism as #2169, where held sync rows hide an optimistic removal. It may need the same law decision: which observations may wait for a persisting transaction.
Suggested witness
A focused Collection-lifecycle witness: a held mutation, then a new live query's preload must settle. Then remove the harness workaround in the query-db refetch oracle, which today defers awaiting preload() until the hold's release.
This issue was written by Isaac.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.9k
- Fork
- 272
- Merge trung bình
- 1 ngày 21 phút
- Pull request đã merge (30 ngày)
- 241
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
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/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
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 5/100
TanStack/db#2186 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
query-db: a Query refetch that joins a loader's refetch acquisition does not report shifted pagesĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
TanStack/db#2185 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Ordered loader: a page-capping provider loses a moved row from a joined window after refetchĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/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 68/100
apache/rocketmq-dashboard#6872 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fab-geocommuns/RNB-site#539 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Guest multiview tile label leaks raw virtual-source-id "Whip" instead of the guest name / slot labelĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Eyevinn/open-live-studio#211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
sujithputta02/Esapay#13 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ehmpathy/rhachet-roles-bhuild#468 ·
Maintainer thường phản hồi trong vòng 1 ngày