mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 18:13:58 +00:00
inbox_ui: Fix buggy save and restore of navigation state.
The previous logic only worked correctly when user moved from inbox view to channel topic list view and vice versa. The logic failed if user moves out of inbox since then `save` state is never called and hence when restore is called, the navigation state gets reset. Fixed by also saving state when inbox is hidden.
This commit is contained in:
@@ -257,6 +257,7 @@ function restore_inbox_view_state(): void {
|
||||
export function show(filter?: Filter): void {
|
||||
assert(hide_other_views_callback !== undefined);
|
||||
hide_other_views_callback();
|
||||
const was_inbox_already_visible = inbox_util.is_visible();
|
||||
// Avoid setting col_focus to recipient when moving to inbox from other narrows.
|
||||
// We prefer to focus entire row instead of stream name for inbox-header.
|
||||
// Since inbox-row doesn't has a collapse button, focus on COLUMNS.COLLAPSE_BUTTON
|
||||
@@ -279,11 +280,11 @@ export function show(filter?: Filter): void {
|
||||
// do anything here if view for the same channel is visible.
|
||||
return;
|
||||
}
|
||||
} else if (!was_inbox_channel_view && is_new_filter_channel_view) {
|
||||
} else if (was_inbox_already_visible && !was_inbox_channel_view && is_new_filter_channel_view) {
|
||||
save_inbox_view_state();
|
||||
}
|
||||
|
||||
if (was_inbox_channel_view) {
|
||||
if (was_inbox_already_visible && was_inbox_channel_view) {
|
||||
save_channel_view_state();
|
||||
}
|
||||
|
||||
@@ -358,6 +359,12 @@ export function hide(): void {
|
||||
set_visible: inbox_util.set_visible,
|
||||
});
|
||||
|
||||
if (inbox_util.is_channel_view()) {
|
||||
save_channel_view_state();
|
||||
} else {
|
||||
save_inbox_view_state();
|
||||
}
|
||||
|
||||
inbox_util.set_filter(undefined);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user