user topics: Delay rerendering all messages.

Rerendering of "all messages" is slow, and by definition, not visible
to the user, so make sure the browser gets an opportunity to rerender
the content that is visible before starting that expensive
computation.
This commit is contained in:
Tim Abbott 2023-10-17 15:43:48 -07:00
parent 17a0304309
commit 401c8bbb21
1 changed files with 8 additions and 3 deletions

View File

@ -18,9 +18,6 @@ export function handle_topic_updates(user_topic_event) {
stream_list.update_streams_sidebar();
unread_ui.update_unread_counts();
message_lists.current.update_muting_and_rerender();
if (message_lists.current !== message_lists.home) {
message_lists.home.update_muting_and_rerender();
}
recent_view_ui.update_topic_visibility_policy(
user_topic_event.stream_id,
user_topic_event.topic_name,
@ -48,6 +45,14 @@ export function handle_topic_updates(user_topic_event) {
settings_user_topics.populate_list();
}
}
setTimeout(0, () => {
/* Rerender "all messages" if necessary, but defer until after
* the browser has rendered the DOM updates scheduled above. */
if (message_lists.current !== message_lists.home) {
message_lists.home.update_muting_and_rerender();
}
});
}
export function toggle_topic_visibility_policy(message) {