Jittery scrolling through unread posts #228
Labels
No labels
area/ci
area/desktop
area/packaging
area/protocol
area/reading
area/ui
area/web
area/writing
kind/bug
kind/feature
kind/infra
kind/request
needs/user
parked
perf
security
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
littlefox/neokom#228
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reported by the user (D-057): scrolling quickly through unread posts jitters. The user suspects marking posts read makes the UI wait for something.
What the code does today (#180):
SEEN_JSinapp/src/main_view/mod.rsruns every 250 ms. It callsgetBoundingClientRecton every unread card, which forces layout while you scroll.kom.mark_read(a server round trip), then bumpstick.tickreloads and re-renders the whole thread (see the redraw issue). That probably causes the jitter more than the round trip itself does.JUST_SEENis written for every card, which also re-renders the thread.Directions:
IntersectionObserverinstead of polling layout.Done when: scrolling quickly through a few hundred unread cards has no long tasks (the measuring spec) and looks smooth on desktop and phone.
More from the codebase review (#230):
SEEN_JSruns every 250 ms even when nothing scrolls (#233).mark-as-readcall; batching them is in #234.JUST_SEENand bumpstick, both of which redraw the thread (#226).Merged in #254; main run #426 green. Verified: full e2e suite on three profiles (327 passed) and
tools/perf.shagainst the baseline. Reading 120 cards by scrolling past them: server calls 287 → 99, layouts 119 → 35, style recalcs 126 → 61, main-thread time 1.2 → 0.37 s. Reading 300 posts along the chain: style recalcs −33 %. Idle main-thread time 0.03 → 0.01 s per 20 s.