mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +00:00
narrow: Use update_current_message_list instead of set_current.
It's important to remove the focused class and remote the old message list from DOM which only happens in update_current_message_list.
This commit is contained in:
@@ -55,10 +55,25 @@ export type MessageList = {
|
||||
export let home: MessageList | undefined;
|
||||
export let current: MessageList | undefined;
|
||||
|
||||
export function set_current(msg_list: MessageList): void {
|
||||
function set_current(msg_list: MessageList): void {
|
||||
// NOTE: Use update_current_message_list instead of this function.
|
||||
current = msg_list;
|
||||
}
|
||||
|
||||
export function update_current_message_list(msg_list: MessageList): void {
|
||||
if (msg_list !== home) {
|
||||
home?.view.$list.removeClass("focused-message-list");
|
||||
}
|
||||
|
||||
if (current !== home) {
|
||||
// Remove old msg list from DOM.
|
||||
current?.view.$list.remove();
|
||||
}
|
||||
|
||||
set_current(msg_list);
|
||||
current?.view.$list.addClass("focused-message-list");
|
||||
}
|
||||
|
||||
export function set_home(msg_list: MessageList): void {
|
||||
home = msg_list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user