mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
Fix un-narrowing while the home view messages are still loading.
The bug we experienced here was that if you loaded the page in a narrowed view, and then un-narrowed before the first block of messages for the home view arrived via load_old_messages, then narrow.deactivate() would re-select ID -1 in home_msg_list. This ends up calling recenter_view() on the message, which in turn tries to access the message with message id -1, which fails. We do sometimes re-select a message ID in order to recenter the view properly when we prepend messages to a message list, so we can't make this always a nop; instead we add a check for id -1 in the message_selected.zephyr event handler. (imported from commit 66f84a586e59d99aaf0e4ba2cda9fe597b033145)
This commit is contained in:
@@ -1191,6 +1191,10 @@ $(function () {
|
||||
if (current_msg_list !== event.msg_list) {
|
||||
return;
|
||||
}
|
||||
if (event.id === -1) {
|
||||
// If the message list is empty, don't do anything
|
||||
return;
|
||||
}
|
||||
var row = rows.get(event.id, event.msg_list.table_name);
|
||||
$('.selected_message').removeClass('selected_message');
|
||||
row.addClass('selected_message');
|
||||
|
||||
Reference in New Issue
Block a user