diff --git a/web/src/admin.js b/web/src/admin.js index 2a1ccef973..f37401d187 100644 --- a/web/src/admin.js +++ b/web/src/admin.js @@ -231,8 +231,6 @@ export function build_page() { } export function launch(section) { - settings.build_page(); - build_page(); settings_sections.reset_sections(); settings.open_settings_overlay(); diff --git a/web/src/hashchange.js b/web/src/hashchange.js index 27b23157f8..1e1e49f650 100644 --- a/web/src/hashchange.js +++ b/web/src/hashchange.js @@ -343,11 +343,15 @@ function do_hashchange_overlay(old_hash) { } if (base === "settings") { + settings.build_page(); + admin.build_page(); settings.launch(section); return; } if (base === "organization") { + settings.build_page(); + admin.build_page(); admin.launch(section); return; } diff --git a/web/src/settings.js b/web/src/settings.js index 25521cb62c..5fb9134a74 100644 --- a/web/src/settings.js +++ b/web/src/settings.js @@ -5,7 +5,6 @@ import timezones from "../generated/timezones.json"; import render_settings_overlay from "../templates/settings_overlay.hbs"; import render_settings_tab from "../templates/settings_tab.hbs"; -import * as admin from "./admin"; import * as blueslip from "./blueslip"; import * as browser_history from "./browser_history"; import {$t, $t_html} from "./i18n"; @@ -134,8 +133,6 @@ export function open_settings_overlay() { } export function launch(section) { - build_page(); - admin.build_page(); settings_sections.reset_sections(); open_settings_overlay(); diff --git a/web/tests/hashchange.test.js b/web/tests/hashchange.test.js index c33cee784a..df9c3737d6 100644 --- a/web/tests/hashchange.test.js +++ b/web/tests/hashchange.test.js @@ -125,11 +125,13 @@ function test_helper({override, change_tab}) { } stub(admin, "launch"); + stub(admin, "build_page"); stub(drafts, "launch"); stub(message_viewport, "stop_auto_scrolling"); stub(narrow, "deactivate"); stub(overlays, "close_for_hash_change"); stub(settings, "launch"); + stub(settings, "build_page"); stub(stream_settings_ui, "launch"); stub(ui_util, "blur_active_element"); stub(ui_report, "error"); @@ -294,6 +296,8 @@ run_test("hash_interactions", ({override}) => { $window_stub.trigger("hashchange"); helper.assert_events([ [overlays, "close_for_hash_change"], + [settings, "build_page"], + [admin, "build_page"], [settings, "launch"], ]); @@ -303,6 +307,8 @@ run_test("hash_interactions", ({override}) => { $window_stub.trigger("hashchange"); helper.assert_events([ [overlays, "close_for_hash_change"], + [settings, "build_page"], + [admin, "build_page"], [admin, "launch"], ]);