mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
message_events: Avoid full rerender when marking unread.
Previously, when you did a "mark as unread from here" operation, we triggered a full rerender of both the recent topics view and the message feed. This was needlessly expensive, on and a large server with a somewhat busy CPU from other applications, can cause a visible lag, even when the message feed that you're looking at only has like 3 messages in it. Improve this by passing the set of modified messages to the rerender. There's likely further improvements to be made here -- we shouldn't need to do more than toggle the unread markers -- but this should be good enough to eliminate the visible lag. Fixes #24263.
This commit is contained in:
committed by
GitHub
parent
e9bfdd1bf2
commit
d335cb34af
@@ -8,6 +8,19 @@ export function rerender_messages_view() {
|
||||
}
|
||||
}
|
||||
|
||||
export function rerender_messages_view_by_message_ids(message_ids) {
|
||||
const messages_to_render = [];
|
||||
for (const id of message_ids) {
|
||||
const message = message_store.get(id);
|
||||
if (message !== undefined) {
|
||||
messages_to_render.push(message);
|
||||
}
|
||||
}
|
||||
for (const list of message_lists.all_rendered_message_lists()) {
|
||||
list.view.rerender_messages(messages_to_render);
|
||||
}
|
||||
}
|
||||
|
||||
function rerender_messages_view_for_user(user_id) {
|
||||
for (const list of message_lists.all_rendered_message_lists()) {
|
||||
const messages = list.data.get_messages_sent_by_user(user_id);
|
||||
|
||||
@@ -329,7 +329,7 @@ export function process_unread_messages_event({message_ids, message_details}) {
|
||||
The main downside of doing a full rerender is that it can be
|
||||
user-visible in the form of users' avatars flickering.
|
||||
*/
|
||||
message_live_update.rerender_messages_view();
|
||||
message_live_update.rerender_messages_view_by_message_ids(message_ids);
|
||||
recent_topics_ui.complete_rerender();
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user