Select closest id in MessageList.rerender().

When we call rerender() on MessageList, it is usually because
something big has happened, so it's reasonable that the pointer
may now be invalid.  As an example, the old pointed-to message
may been removed from the home view.  We have always just
moved the pointer under the hood, but now we do it in a way
that doesn't generate spurious blueslip errors.

(imported from commit d399a101f36b744a423ea7da80dda8352440c6c9)
This commit is contained in:
Steve Howell 2013-09-30 15:23:57 -04:00
parent 0e23b2240d
commit ec1c82d6d7
1 changed files with 1 additions and 1 deletions

View File

@ -422,6 +422,7 @@ MessageList.prototype = {
// We need to clear the rendering state, rather than just
// doing clear_table, since we want to potentially recollapse
// things.
this._selected_id = this.closest_id(this._selected_id);
this.view.clear_rendering_state(false);
this.view.update_render_window(this.selected_idx(), false);
this.view.rerender_preserving_scrolltop();
@ -436,7 +437,6 @@ MessageList.prototype = {
}
this._items = this.unmuted_messages(this._all_items);
this._selected_id = this.closest_id(this._selected_id);
this.rerender();
},