Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

A second live query over a refetched on-demand source keeps a short joined window

未關閉
#2,155 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
12/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript
領域
data

研究方向

The payload names no source files, so start from the ordered-work oracle in #2132 and replay seed 3103989100, which is pinned as an it.fails case. Find where the second live-query Collection's ordered loader decides whether to request more rows after a refetch. The fix is done when that replay passes, the it.fails marker is removed, and the refetching-provider plus second-Collection combination can return to the random grammar.

由索引模型根據 Issue 內容生成。

描述

Problem

Two live-query Collections can read the same on-demand source. After a refetch, the second Collection can show a short ordered window. It stays short until a different change starts a load.

The ordered-work oracle in #2132 found this with a generated history. The failure also occurs with the production code on main, so #2132 does not cause it.

Minimal trace

  • On-demand source with a refetching provider. The provider sends no change until a refetch, and each refetch keeps every served ordered range whole.
  • Query: rows LEFT JOIN markers on the row's join key (link), WHERE the marker exists, ORDER BY rank ASC with an index on rank.
  • Collection A has limit 2. Collection B (the second live-query Collection) has limit 3.
  • Rows 9, 0 and 1 have rank 0 and a marker. Row 2 has rank 1 and no marker. 200 filler rows have rank 100 and up, with markers.

Steps:

  1. The backend inserts row 10, with rank 1 and no marker. The provider does not send it yet.
  2. Row 0 changes its join key, so it no longer matches a marker. The provider does not send this yet.
  3. The provider refetches.

Expected window of Collection B: ranks [0, 0, 100] (rows 9, 1 and the first filler row). Actual window: [0, 0]. Collection A shows the expected window.

Ingredients

The failure needs all of these:

  • A refetching provider. A forwarding provider passes.
  • A second live-query Collection on the same source. One Collection with limit 3 passes.
  • A join on the row's join key. The same history with marker changes passes.
  • A tie at the window boundary with a row that the provider never sent. Without the insert of row 10, the history passes.

A source filter instead of a joined filter also passes.

Hypothesis

After the refetch, row 0 leaves both windows in one commit. Collection B must load past the rank-1 tie group, where every row fails the join. Two causes are possible:

  • Collection B's ordered loader does not request again, because its last page has the same count and boundary as before.
  • The rows that Collection A already loaded answer the request of Collection B.

Then nothing proves the window, and no request follows.

Evidence

  • Witness trace: oracle seed 3103989100 of the ordered-work oracle in #2132. #2132 pins it as an it.fails replay, and excludes the refetching-provider and second-Collection combination from the random grammar until this fix.

This issue was written by Isaac.

主要語言
TypeScript
星號
3.9k
分支
277
平均合併
22 小時 54 分鐘
30 天內合併 PR
236

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TanStack/db 的其他 Issue

查看 TanStack/db 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。