"Visa fler" budget counts every thread ever opened #235

Closed
opened 2026-10-21 19:17:26 +00:00 by littlefox · 1 comment
Owner

Found while looking into scrolling (#230, D-058). This bug came with #223 (#220).

opened in app/src/main_view/mod.rs holds every post whose "Visa fler" was clicked. It is never cleared: the comment says texts of other threads in it don't matter. They do. Kom::thread gives an opened branch a budget of OPEN_BUDGET * open.len(), counting all opened posts, including other threads'.

So after "Visa fler" in 20 threads, the next click anywhere opens up to 2 000 posts instead of 100. The set is also cloned on every thread load, and grows for the whole session.

Fix:

  • count only the opened posts that are in this thread, or keep opened per thread root and drop it when the thread is left;
  • add a test in thread_tree with an opened post from another thread.
Found while looking into scrolling (#230, D-058). This bug came with #223 (#220). `opened` in `app/src/main_view/mod.rs` holds every post whose "Visa fler" was clicked. It is **never cleared**: the comment says texts of other threads in it don't matter. They do. `Kom::thread` gives an opened branch a budget of `OPEN_BUDGET * open.len()`, counting *all* opened posts, including other threads'. So after "Visa fler" in 20 threads, the next click anywhere opens up to 2 000 posts instead of 100. The set is also cloned on every thread load, and grows for the whole session. Fix: - count only the opened posts that are in this thread, or keep `opened` per thread root and drop it when the thread is left; - add a test in `thread_tree` with an opened post from another thread.
Author
Owner

Merged in #248; main run #403 green. Verified: the devserver test thread_tree opens a 110-link chain at its root with and without posts opened elsewhere and expects the same; it failed before the fix and passes after. thread.spec and show-more.spec pass in CI.

Merged in #248; main run #403 green. Verified: the devserver test `thread_tree` opens a 110-link chain at its root with and without posts opened elsewhere and expects the same; it failed before the fix and passes after. thread.spec and show-more.spec pass in CI.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
littlefox/neokom#235
No description provided.