Long lists like Discord: draw only what is near, cache some, refetch the rest #236
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#236
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?
The user, 2026-10-21: "I am especially interested in what happens when scrolling back and forth between posts and replies. Will the page grow outside all bounds or will only the posts that you are "near" be actually on the page? I am thinking of how discord handles long chats. You can scroll and scroll, but discord will only hold so many messages in the drawable window. Some are cached in the background and others still are marked as stale to be re-fetched from the server"
What NeoKOM does today
There is no windowing anywhere: everything loaded is on the page.
Thread view (
ThreadPane):THREAD_CAP = 100cards, plus 100 more for each "Visa fler". Never fewer.previewsis cleared), so it is bounded per thread, apart from the bug in #235.Channel view (
ChannelPostsPane, #176):Behind the page (
kom-client):text_stats,bodiesanduconfskeep everything fetched, for the whole session, with no limit.What it should be (Discord-like, to settle in DESIGN.md)
Things to keep working
aria-setsize/aria-posinseton the list items..thread-itemneed to change.Measure with #225: DOM nodes and memory after scrolling 2 000 posts back and forth, which should stay flat, and the time to scroll back to the start.
Related: #226 (redraws), #227 (memory), #229 (settling).
Narrowed 2026-10-21 (the user agreed): #242 replaces the channel and thread views in 1.0, so this issue builds the shared pieces, not a windowed version of today's views:
aria-setsize/aria-posinset;kom-client(count and bytes, LRU) for stats, bodies and built views, with staleness and refetch on view.Use them in the current views only where it is cheap: the channel view's "Visa äldre" list and coming back to it. The thread view keeps its cap until #242. Designed with #242's layout in mind (mockups there).
Merged in #270 (main #452 green). The channel view draws only the posts near the screen (IntersectionObserver, 1500 px margin); posts further away become empty blocks of the same height. Kom's caches now have budgets (
kom_client::lru: 20 000 stats, 32 MB of bodies, 5 000 conferences). Measured with tools/perf.sh, scrolled back through 840 posts: 45 posts drawn, wasm memory 14 MB (was 89 MB), DOM nodes at the end 7 074 (was 17 187). New spec e2e/tests/channel-window.spec.ts; full suite green; screenshots checked.