From 03897c42e1fdae479ab6499a5dc8eba289e3eebe Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Fri, 19 Sep 2025 16:19:27 +0530 Subject: [PATCH] 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. --- web/src/ui_init.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/ui_init.js b/web/src/ui_init.js index 5f8a315b86..a38d77e78c 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -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();