Aditya Patil dcd7ad6114
fix: refetch the open channel after background when its window is deep or was jumped to (#2281)
* fix: refetch the open channel after background when its window is deep or was jumped to

* fix: catch up a claimed window instead of replacing it

* fix: bound the deep-window catch-up to what the window can hold

The catch-up merge trims the oldest rows past the window cap, and in a
deep window those are the rows being read — losing them yanked the
scroll. The request is now capped to the window's headroom, and a full
window skips the catch-up; when more arrived than fits, the page
detaches the window and "jump to present" takes over. Adds loader tests
for the replace, catch-up, headroom and full-window cases, and updates
the performance notes.

* fix: refresh the open channel's whole window after a connection break
A window deeper than 70 messages, or one reached by a jump, got no
refresh on resume: new messages, reactions, edits and deletes from the
gap were all missed until the channel was reopened. Tapping a
notification for the open channel did not reopen it, so that could be
a long wait.
The quiet refresh now refetches the window's own span, from its oldest
message up and capped at the window limit, through a new
include_from_message flag on get_newer_messages. The messages being
read are always in the response, so nothing is dropped and the scroll
never moves, at any depth; every loaded message comes back in its
current state, so changes to existing messages land too, and a message
that does not come back is removed. Unchanged messages keep their
objects. This replaces the depth guard and the newer-only catch-up.

* fix: harden the window refresh against reactions, deletes and mid-flight changes

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>
2026-10-12 15:50:33 +05:30
..
2026-07-28 21:13:28 +05:30