Skip to content

fix(threads): prefetch history near the reading position - #1450

Merged
nixuuu merged 1 commit into
devfrom
feat/viewport-triggered-history-loading
Nov 28, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/viewport-triggered-history-loading

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 28, 2026

Copy link
Copy Markdown
Member

Change

A fast jump through a thread could leave several “Show earlier work” buttons on screen until the next upward gesture. Web and desktop now fetch a page when a gap or the start of the loaded history comes within 240 CSS pixels of the reading area. The feed waits for its initial position, then rechecks the current window after each page. Failed reads expose the existing retry action.

When older rows turn out shorter than their estimates, the feed restores the reading anchor before it decides whether to follow the end. This keeps the same message on screen across consecutive reads.

Verification

  • Exercised the real thread route in Chromium with 96 turns and 1,112 items. After Home, five sequential reads filled all six visible gaps with the first prompt moving less than one pixel. Also checked a fast wheel gesture at 390 px wide.
  • Approached a gap from each direction. Requests started with the gap still offscreen and stopped outside the margin. A short thread with a visible gap loaded on opening. An HTTP 503 paused automatic reads until Retry.
  • Kept an answer within half a CSS pixel of its position through four pages of a 540-command turn. Closing the last work fold still resumed following at the end.
  • Web typecheck, lint on changed files and 15 existing history and scroll tests passed locally. Repository-wide checks and selected builds run in CI.

Fixes: #1049
Fixes: #781

Page through nearby gaps in either direction and while the reader is stationary. Restore the reading anchor before a shrinking estimate can re-enable following at the end.

Fixes: #1049
Fixes: #781
@nixuuu
nixuuu enabled auto-merge (squash) November 28, 2026 20:46
@nixuuu
nixuuu merged commit 457b8ac into dev Nov 28, 2026
45 of 47 checks passed
@nixuuu
nixuuu deleted the feat/viewport-triggered-history-loading branch November 28, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant