Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recent-topics: Check topic exists when trying to revive focus.
Lauryn Menard3de4fd5fbb9d
diff --git a/static/js/recent_topics_ui.js b/static/js/recent_topics_ui.jsindex 53c4794fd03..77be5bc4fec 100644--- a/static/js/recent_topics_ui.js+++ b/static/js/recent_topics_ui.js@@ -190,17 +190,20 @@ export function revive_current_focus() {if (is_table_focused()) {if (last_visited_topic) {- const topic_last_msg_id = topics.get(last_visited_topic).last_msg_id;- const current_list = topics_widget.get_current_list();- const last_visited_topic_index = current_list.findIndex(- (topic) => topic.last_msg_id === topic_last_msg_id,- );- if (last_visited_topic_index >= 0) {- row_focus = last_visited_topic_index;+ // If the only message in the topic was deleted,+ // then the topic will not be in recent topics data.+ if (topics.get(last_visited_topic) !== undefined) {+ const topic_last_msg_id = topics.get(last_visited_topic).last_msg_id;+ const current_list = topics_widget.get_current_list();+ const last_visited_topic_index = current_list.findIndex(+ (topic) => topic.last_msg_id === topic_last_msg_id,+ );+ if (last_visited_topic_index >= 0) {+ row_focus = last_visited_topic_index;+ }}last_visited_topic = "";}-set_table_focus(row_focus, col_focus);return true;}