ui_init: Restore guard against direct use of page_params.state_data.

Before commit fd253539e0 (#30519), each
part of state_data was removed by pop_fields, to ensure that it was
only used by its associated module and not manipulated directly.
Restore this guarantee by removing page_params.state_data itself.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-06-22 23:34:06 -07:00
committed by Tim Abbott
parent 3a7f5da717
commit 95a2ce6ed6

View File

@@ -670,7 +670,7 @@ export function initialize_everything(state_data) {
$("#app-loading").addClass("loaded");
}
$(async () => {
$(() => {
if (page_params.is_spectator) {
const data = {
apply_markdown: true,
@@ -699,7 +699,9 @@ $(async () => {
},
});
} else {
assert(page_params.state_data !== undefined);
initialize_everything(page_params.state_data);
const state_data = page_params.state_data;
assert(state_data !== null);
page_params.state_data = null;
initialize_everything(state_data);
}
});