Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_list_view: Fix exception prepending when visibly empty.
Tim Abbott23eaa8763503
diff --git a/web/src/message_list_view.js b/web/src/message_list_view.jsindex 62853606a17..a66a8003444 100644--- a/web/src/message_list_view.js+++ b/web/src/message_list_view.js@@ -1336,6 +1336,21 @@ export class MessageListView {}prepend(messages) {+ if (this._render_win_end - this._render_win_start === 0) {+ // If the message list previously contained no visible+ // messages, appending and prepending are equivalent, but+ // the prepend logic will throw an exception, so just+ // handle this as an append request.+ //+ // This is somewhat hacky, but matches how we do rendering+ // for the first messages in a new msg_list_data object.+ this.append(messages, false);+ return;+ }++ // If we already have some messages rendered, then prepending+ // will effectively change the meaning of the existing+ // numbers.this._render_win_start += messages.length;this._render_win_end += messages.length;