ui_init: Fix flashing of 'try zulip' modal.

On visiting 'https://chat.zulip.org/?show_try_zulip_modal',
a 'try zulip' modal is displayed to spectators.

Previously, the modal flashed briefly and disappeared.

Reason:
Earlier, in 'ui_init.js' we called 'show_try_zulip_modal'
followed by a network call - which on success called
'initialize_everything'.

'hashchange.initialize' (in 'initialize_everything') closes
any active modal.

So, the race between 'show_try_zulip_modal' & 'hashchange.initialize'
was resulting in this flash.

Fix:
We call 'show_try_zulip_modal' only after 'initialize_everything'
completes - there's no point to try to display modal when the
loading screen is still visible to users.
This commit is contained in:
Prakhar Pratyush
2025-09-19 16:19:27 +05:30
committed by Tim Abbott
parent 7f81665b58
commit 03897c42e1

View File

@@ -776,9 +776,6 @@ $(() => {
}
if (page_params.is_spectator) {
if (page_params.show_try_zulip_modal) {
show_try_zulip_modal();
}
const data = {
apply_markdown: true,
client_capabilities: JSON.stringify({
@@ -798,6 +795,9 @@ $(() => {
success(response_data) {
const state_data = state_data_schema.parse(response_data);
initialize_everything(state_data);
if (page_params.show_try_zulip_modal) {
show_try_zulip_modal();
}
},
error() {
$("#app-loading-middle-content").hide();