narrow_history: Save narrow state after we have scrolled to the msg.

Saving narrow state before we have scrolled to the message results
in view scroll position being different from where the message
is displayed.
This commit is contained in:
Aman Agrawal 2024-10-21 06:45:00 +00:00 committed by Tim Abbott
parent b895e9dc6f
commit 8aca0a7776
1 changed files with 3 additions and 1 deletions

View File

@ -319,7 +319,6 @@ export function initialize_kitchen_sink_stuff() {
const $row = event.msg_list.get_row(event.id); const $row = event.msg_list.get_row(event.id);
$(".selected_message").removeClass("selected_message"); $(".selected_message").removeClass("selected_message");
$row.addClass("selected_message"); $row.addClass("selected_message");
narrow_history.save_narrow_state();
if (event.then_scroll) { if (event.then_scroll) {
if ($row.length === 0) { if ($row.length === 0) {
@ -355,6 +354,9 @@ export function initialize_kitchen_sink_stuff() {
}); });
} }
} }
// Save selected message and scroll position after we have scrolled to it.
narrow_history.save_narrow_state();
}); });
if (!realm.realm_allow_message_editing) { if (!realm.realm_allow_message_editing) {