aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread-prefetch.js
Commit message (Collapse)AuthorAgeFilesLines
* Threads open at once from the replies already in hand, and fill in as the ↵Adam Soltys13 hours1-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | relays answer. Adam, 2026-10-16: "Still seeing a spinner sometimes when I click into a thread." Three things stood between a tap and the conversation. (1) The feed already fetches every reply to each post on screen — the count on the reply button comes from them (watchZaps, kinds 1 and 1111 by #e) — and then kept only their ids. Now the replies themselves are kept (replyEvents: the 400 targets most recently heard from, 60 each) and a thread is seeded from them when it is opened (repliesInHand: those naming the root, and those naming only the reply they answer), so a post that has been on screen opens as the whole conversation, no relay asked; a thread fetched ahead before the count answered takes them when opened, and the open thread takes them when the count fetch lands (adoptRepliesInHand). (2) The loader waited for every relay's EOSE — the slowest relay, 4.5 s at worst — before the thread replaced its spinner; now replies go in as they arrive (queryStreamOn), the page repainted in place, and the root the moment it is found. (3) The spinner stood under whatever was already there while the load ran; now it shows only while there is nothing to read, and "no replies" only once the relays have spoken. And the fetch-ahead fires after 600 ms of reading instead of 1.2 s (a quick reader beat it to the tap), a dozen a minute. tools/thread-instant-test.js (the relays answered in the page): a post read for a moment is fetched ahead, the count answer released only after that entry exists, and the thread opens with its reply 12 ms after the tap, not after its own 6 s ask; a post on screen opens whole in 16 ms with the three replies the count brought, before the relays answer the thread's ask, and their answer adds nothing twice; a post with nothing in hand shows a spinner, then its first reply at ~470 ms with the slow one still on its way, the spinner gone, the slow one landing in place. thread-prefetch-test follows the new dwell and rate; thread-cache, thread-pager, thread-back-scroll, feed-conversations, moderation, feed-live, feed-switch-seed, profile-pager, notif-report-fold and reply-count pass (thread-reply-test's 30 s wait fails on clean HEAD the same way). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01J1Kon8bxJoHRpJdSzshCkp
* Prefetch visible post threads after a bounded reading dwellAdam Soltys9 days1-0/+53