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: Fix UI fails to update when marking messages read.

Aman Agrawalb2151a333d23
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts
index 5894a14c6d0..b007d8d2996 100644
--- a/web/src/recent_view_ui.ts
+++ b/web/src/recent_view_ui.ts
@@ -369,6 +369,12 @@ export function get_focused_row_message(): Message | undefined {
const $topic_rows = $("#recent-view-content-tbody tr");
const $topic_row = $topic_rows.eq(row_focus);
+ if ($topic_row.length === 0) {
+ // There are less items in the table than `row_focus`.
+ // We don't reset `row_focus` here since that is not the
+ // purpose of this function.
+ return undefined;
+ }
const topic_id = $topic_row.attr("id");
assert(topic_id !== undefined);
const conversation_id = topic_id.slice(recent_conversation_key_prefix.length);