Revert "recent_view_ui: Avoid non-contiguous rows in recent view."

This reverts commit 2348d6f1f9.
This commit is contained in:
Anders Kaseorg
2023-10-16 13:57:02 -07:00
parent effc9c366a
commit 8ebcaddfd9
2 changed files with 8 additions and 15 deletions

View File

@@ -61,11 +61,9 @@ function process_result(data, opts) {
} }
} }
if (messages.length > 0 && (opts.msg_list === message_lists.home || opts.is_recent_view_data)) { if (messages.length > 0 && opts.msg_list === message_lists.home) {
recent_view_ui.process_messages(messages); // We keep track of how far back we've fetched messages for, for messaging in
// the recent view. This assumes `data.messages` is already sorted.
// Update the recent view UI's understanding of which messages
// we have available for the recent view.
const oldest_timestamp = all_messages_data.first().timestamp; const oldest_timestamp = all_messages_data.first().timestamp;
recent_view_ui.set_oldest_message_date( recent_view_ui.set_oldest_message_date(
oldest_timestamp, oldest_timestamp,
@@ -75,6 +73,7 @@ function process_result(data, opts) {
} }
huddle_data.process_loaded_messages(messages); huddle_data.process_loaded_messages(messages);
recent_view_ui.process_messages(messages);
stream_list.update_streams_sidebar(); stream_list.update_streams_sidebar();
stream_list.maybe_scroll_narrow_into_view(); stream_list.maybe_scroll_narrow_into_view();
@@ -592,7 +591,6 @@ export function initialize(home_view_loaded) {
num_before: consts.recent_view_initial_fetch_size, num_before: consts.recent_view_initial_fetch_size,
num_after: 0, num_after: 0,
msg_list_data: recent_view_message_list_data, msg_list_data: recent_view_message_list_data,
is_recent_view_data: true,
cont: recent_view_ui.hide_loading_indicator, cont: recent_view_ui.hide_loading_indicator,
}); });
} }

View File

@@ -370,15 +370,10 @@ export function hide_loading_indicator() {
} }
export function process_messages(messages) { export function process_messages(messages) {
// This code path processes messages from 3 sources: // While this is inexpensive and handles all the cases itself,
// the UX can be bad if user wants to scroll down the list as
// 1. Newly sent messages from the server_events system. This is safe to // the UI will be returned to the beginning of the list on every
// process because we always will have the latest previously sent messages. // update.
// 2. Messages in all_messages_data, the main cache of contiguous
// message history that the client maintains.
// 3. Latest messages fetched specifically for Recent view when
// the browser first loads. We will be able to remove this once
// all_messages_data is fetched in a better order.
let conversation_data_updated = false; let conversation_data_updated = false;
if (messages.length > 0) { if (messages.length > 0) {
for (const msg of messages) { for (const msg of messages) {