From c2df278f6dbcccb71c48a5c86f4e0368aa594563 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Tue, 7 Jan 2025 21:05:16 +0530 Subject: [PATCH] recent_view: Fix `Load more` not working after fetching 50k messages. We do another fetch for `recent_view_fetch_more_batch_size` after reaching 50k limit each time `Load more` is pressed. --- web/src/message_fetch.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/web/src/message_fetch.ts b/web/src/message_fetch.ts index 06d33589e5..6901859681 100644 --- a/web/src/message_fetch.ts +++ b/web/src/message_fetch.ts @@ -565,14 +565,17 @@ export function maybe_load_older_messages(opts: { } if (fetched_substantial_history && found_first_unread) { - recent_view_ui.set_backfill_in_progress(false); - return; + // Once we have fetched enough history, we just do fetches in + // `consts.recent_view_fetch_more_batch_size`. + opts.cont = () => { + recent_view_ui.set_backfill_in_progress(false); + }; + } else { + opts.cont = () => + setTimeout(() => { + maybe_load_older_messages(opts); + }, consts.catch_up_backfill_delay); } - - opts.cont = () => - setTimeout(() => { - maybe_load_older_messages(opts); - }, consts.catch_up_backfill_delay); } do_backfill({ msg_list: opts.msg_list,