A live query's preload on an on-demand collection waits for any persisting optimistic transaction
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 12/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- databases
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 3.9k
- フォーク
- 272
- 平均マージ
- 22時間 54分
- マージ済み PR(30日)
- 236
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/db のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 5/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bnv-manager-v2: accept_invite creates the Mailcow domain admin before the commit対応中かも @myOmikron が今日担当しました。 オープンbug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
platform:windows tool triaged wontfix
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
nicolettas-muggelbude/RechnungsFee#448 ·
メンテナーはふだん 1 日以内に返信
-
Android bug feature/error-tracking react-native team/error-tracking
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PostHog/posthog-js#5310 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信