reload: Handle early attempts at reload when loading the app.

Trying to preserve state when app modules like message_lists
haven't been init results in errors.
This commit is contained in:
Aman Agrawal 2023-10-07 11:35:57 +00:00 committed by Tim Abbott
parent 5327bcc5ac
commit 8299506e7a
1 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,13 @@ function preserve_state(send_after_reload, save_pointer, save_narrow, save_compo
return;
}
if (!message_lists.home) {
// If we haven't yet initialized the message_lists module,
// we can't preserve state across reloads.
blueslip.log("Can't preserve state; message_lists not yet initialized.");
return;
}
let url = "#reload:send_after_reload=" + Number(send_after_reload);
url += "+csrf_token=" + encodeURIComponent(csrf_token);