From 530406e2ef4d98e14d7094389a9bff88cacc25f7 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 24 Oct 2022 16:06:03 -0700 Subject: [PATCH] resize: Don't call resize_page_components for new messages. The resize handler is a somewhat expensive operation, which we'd like to avoid when processing the receipt of new messages. It's also unclear why it would be necesssary; bottom_whitespace is fixed in size, and the sidebars. --- frontend_tests/node_tests/example5.js | 3 --- static/js/message_events.js | 2 -- static/js/message_util.js | 2 -- 3 files changed, 7 deletions(-) diff --git a/frontend_tests/node_tests/example5.js b/frontend_tests/node_tests/example5.js index 0c2bb3ef28..58db584878 100644 --- a/frontend_tests/node_tests/example5.js +++ b/frontend_tests/node_tests/example5.js @@ -26,7 +26,6 @@ const message_util = mock_esm("../../static/js/message_util"); const notifications = mock_esm("../../static/js/notifications"); const pm_list = mock_esm("../../static/js/pm_list"); const recent_topics_data = mock_esm("../../static/js/recent_topics_data"); -const resize = mock_esm("../../static/js/resize"); const stream_list = mock_esm("../../static/js/stream_list"); const unread_ops = mock_esm("../../static/js/unread_ops"); const unread_ui = mock_esm("../../static/js/unread_ui"); @@ -94,7 +93,6 @@ run_test("insert_message", ({override}) => { helper.redirect(message_util, "add_new_messages"); helper.redirect(notifications, "received_messages"); helper.redirect(recent_topics_data, "process_message"); - helper.redirect(resize, "resize_page_components"); helper.redirect(stream_list, "update_streams_sidebar"); helper.redirect(unread_ops, "process_visible"); helper.redirect(unread_ui, "update_unread_counts"); @@ -112,7 +110,6 @@ run_test("insert_message", ({override}) => { [message_util, "add_new_messages_data"], [message_util, "add_new_messages"], [unread_ui, "update_unread_counts"], - [resize, "resize_page_components"], [unread_ops, "process_visible"], [notifications, "received_messages"], [stream_list, "update_streams_sidebar"], diff --git a/static/js/message_events.js b/static/js/message_events.js index 5083b8896c..c1f488746a 100644 --- a/static/js/message_events.js +++ b/static/js/message_events.js @@ -24,7 +24,6 @@ import {page_params} from "./page_params"; import * as pm_list from "./pm_list"; import * as recent_senders from "./recent_senders"; import * as recent_topics_ui from "./recent_topics_ui"; -import * as resize from "./resize"; import * as stream_list from "./stream_list"; import * as stream_topic_history from "./stream_topic_history"; import * as sub_store from "./sub_store"; @@ -156,7 +155,6 @@ export function insert_new_messages(messages, sent_by_this_client) { if (any_untracked_unread_messages) { unread_ui.update_unread_counts(); } - resize.resize_page_components(); unread_ops.process_visible(); notifications.received_messages(messages); diff --git a/static/js/message_util.js b/static/js/message_util.js index 3545ac952b..716197820a 100644 --- a/static/js/message_util.js +++ b/static/js/message_util.js @@ -3,7 +3,6 @@ import $ from "jquery"; import {all_messages_data} from "./all_messages_data"; import * as loading from "./loading"; import * as message_store from "./message_store"; -import * as resize from "./resize"; import * as unread from "./unread"; import * as unread_ui from "./unread_ui"; @@ -14,7 +13,6 @@ export function do_unread_count_updates(messages, expect_no_new_unreads = false) // The following operations are expensive, and thus should // only happen if we found any unread messages justifying it. unread_ui.update_unread_counts(); - resize.resize_page_components(); } }