diff options
| author | Adam Soltys <[email protected]> | 2026-10-01 22:38:55 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-01 22:38:55 -0700 |
| commit | 94b5a7cf832f7da07c18e9eee10f845799b9b657 (patch) | |
| tree | df8e71f98bcb19b37295f519ab04b31b220cb0c4 /src/feed-window.js | |
| parent | 4e3def3db32630ecd59d6b40c2436068708fe54b (diff) | |
| download | coinosv3-94b5a7cf832f7da07c18e9eee10f845799b9b657.tar.gz coinosv3-94b5a7cf832f7da07c18e9eee10f845799b9b657.zip | |
New posts go in above the first post at the top of the feed
Arrivals used to wait behind the pill whenever the feed header was on
screen. They now go in above the first post with that post held where
it is, so the page grows upward and can be scrolled to before tapping
the pill. While the composer or another header field is in use they
still wait. The pill clears only when the reader scrolls up to the
newest post, not on the hold's own downward correction.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/feed-window.js')
| -rw-r--r-- | src/feed-window.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/feed-window.js b/src/feed-window.js index 88170be..6d351f4 100644 --- a/src/feed-window.js +++ b/src/feed-window.js @@ -1,6 +1,6 @@ // Merge prepared events without inserting between visible posts or evicting // the reading position. Row geometry comes from the currently rendered feed. -export function mergeFeedWindow(notes, shown, additions, { rows = [], height = 0, keep = 200, page = 20 } = {}) { +export function mergeFeedWindow(notes, shown, additions, { rows = [], height = 0, keep = 200, page = 20, holdHead = false } = {}) { const byId = new Map(rows.map((r) => [r.id, r])); const first = rows.find((r) => r.bottom > 0 && r.top < height); const seen = new Set(notes.map((e) => e.id)); @@ -12,9 +12,13 @@ export function mergeFeedWindow(notes, shown, additions, { rows = [], height = 0 // locating the next rendered post: they cannot serve as an anchor. const next = notes.find((n) => n.created_at < e.created_at && byId.has(n.id)); const row = next && byId.get(next.id); - // Even a prepend must wait while the header is visible: anchoring just - // the first post would scroll the header away. - const inView = row && row.top < height && (row === first ? row.top > 0 : row.top >= 0); + // Above the first post on screen is fine even with the header showing: + // that post is held where it is and the header goes up with the rest, + // so the scrollbar shows there's more above without anything you're + // reading moving. holdHead (someone is writing up there) keeps the old + // rule, so the composer isn't scrolled out from under a typing thumb. + const inView = row && row.top < height + && (row === first ? holdHead && row.top > 0 : row.top >= 0); (inView ? deferred : added).push(e); } if (!added.length) return { notes, shown, added, deferred }; |
