Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

recent_view: Check whether a row is rendered after resorting.

Aman Agrawal61bf7674dd21
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts
index ae5295b623a..e22ce7a5cef 100644
--- a/web/src/recent_view_ui.ts
+++ b/web/src/recent_view_ui.ts
@@ -1191,11 +1191,6 @@ export let inplace_rerender = (topic_key: string, is_bulk_rerender?: boolean): b
const topic_data = recent_view_data.conversations.get(topic_key);
assert(topic_data !== undefined);
- const $topic_row = get_topic_row(topic_data);
- // We cannot rely on `topic_widget.meta.filtered_list` to know
- // if a topic is rendered since the `filtered_list` might have
- // already been updated via other calls.
- const is_topic_rendered = $topic_row.length;
assert(topics_widget !== undefined);
if (!is_bulk_rerender) {
// Resorting the topics_widget is important for the case where we
@@ -1207,6 +1202,11 @@ export let inplace_rerender = (topic_key: string, is_bulk_rerender?: boolean): b
topics_widget.filter_and_sort();
}
+ // We cannot rely on `topic_widget.meta.filtered_list` to know
+ // if a topic is rendered since the `filtered_list` might have
+ // already been updated via other calls.
+ const $topic_row = get_topic_row(topic_data);
+ const is_topic_rendered = $topic_row.length;
const current_topics_list = topics_widget.get_current_list();
if (is_topic_rendered && filters_should_hide_row(topic_data)) {
// Since the row needs to be removed from DOM, we need to adjust `row_focus`