Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Optional expiry for persisted demand coverage

Đang mở
#2,211 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
sqlite, typescript
Lĩnh vực
backend, database

Hướng nghiên cứu

Start with the persisted demand coverage proposal in issue #2102 and compare its behavior with the persistedGcTime control discussed in #1380 and #1400. The issue leaves the expiry start time, its relationship to row retention, and the implementation deferred until a user asks; first clarify those design decisions. Done would mean defining the optional expiry behavior and adding a settlement timestamp to the coverage record, as described here.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

The persisted demand coverage proposal (#2102, item 1) lets the persisted wrapper settle an on-demand load from SQLite when that exact demand finished loading in an earlier session. Coverage stays valid until its persisted cache generation ends, or until a later load of the same demand settles.

After a demand is released, its source stops sending changes for it. A deleted or moved row keeps appearing in that demand's offline result until the demand loads again online. For many offline-first apps, the last complete result is the right answer. Others may want a bound on how old a covered result can be before the app stops trusting it offline.

Query DB already has this control for its own retention: persistedGcTime keeps a released Query's persisted rows for a TTL or until revalidated (#1380, #1400).

Proposal

Add an optional expiry to persisted demand coverage. Its shape should follow persistedGcTime:

  • a finite duration measured from when the covered load settled, or from when the demand was released (to be decided);
  • an "until revalidated" value, which is the default and today's proposed behavior.

An expired demand counts as uncovered. It waits for the network and is reported the same way as any uncovered demand.

Not doing yet

Do not implement this until a user asks for it. The default (valid until revalidated or until the generation ends) needs no option. This issue records the design so the coverage record keeps room for a timestamp.

Design notes

  • Store the settlement time with the coverage record now, so that expiry can be added later without a storage migration.
  • Decide whether Query DB's persistedGcTime should drive this expiry for Query Collections, or stay a separate row-retention control.
  • An oracle law would add a clock to the persisted-readiness model: a covered demand settles from SQLite only while its coverage is unexpired at the load's start.

Related: #2102, #1380, #1955.

Ngôn ngữ chính
TypeScript
Star
3.9k
Fork
277
Merge trung bình
18 giờ 7 phút
Pull request đã merge (30 ngày)
228

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/db

Tất cả issue của TanStack/db

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.