mirror of https://github.com/zulip/zulip.git
refactor: Remove brittle check for !select_first_unread.
When we are deciding whether to preserve scroll position, we mainly care that then_select_offset is set to a value. If we had no intention of preserving scroll offset, we would have never bothered to set it. The check for !select_first_unread is always redundant, as verified by lots of clicking around with some print debugging. And it's a brittle check, because it couples the decision of scrolling destination to the mechanism by which we decide our selection. While those things are closely related, it's possible in the future that we'll decide to advance to an unread message and still want to set then_select_offset, but we might forget to mutate select_first_unread. Long story short, the code is simpler and safer now.
This commit is contained in:
parent
3e08270d48
commit
df0e4a73fa
|
@ -168,7 +168,6 @@ exports.activate = function (raw_operators, opts) {
|
|||
}
|
||||
|
||||
var preserve_pre_narrowing_screen_position =
|
||||
!select_first_unread &&
|
||||
(message_list.narrowed.get(then_select_id) !== undefined) &&
|
||||
(then_select_offset !== undefined);
|
||||
|
||||
|
|
Loading…
Reference in New Issue