From 9554079e4b71a1936b13288e82fe73628abb5bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Nov 2017 16:48:07 +0100 Subject: [PATCH] Slight refactoring of CoreUI init order We must not fire the StartupComplete callback before we've signaled that we are done loading the UI in the UiStateViewModel. --- src/octoprint/static/js/app/main.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index 0c374b4c5..ace20dda9 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -660,10 +660,6 @@ $(function() { callViewModels(allViewModels, "onAllBound", [allViewModels]); log.info("... binding done"); - // startup complete - callViewModels(allViewModels, "onStartupComplete"); - setOnViewModels(allViewModels, "_startupComplete", true); - // make sure we can track the browser tab visibility OctoPrint.coreui.onBrowserVisibilityChange(function(status) { log.debug("Browser tab is now " + (status ? "visible" : "hidden")); @@ -674,12 +670,18 @@ $(function() { changeTab(); }); - if (window.location.hash != "") + if (window.location.hash !== "") { changeTab(); } log.info("Application startup complete"); + + viewModelMap["uiStateViewModel"].loading(false); + + // startup complete + callViewModels(allViewModels, "onStartupComplete"); + setOnViewModels(allViewModels, "_startupComplete", true); }; var fetchSettings = function() { @@ -749,7 +751,6 @@ $(function() { // This is to ensure that we have no concurrent requests triggered by socket events // overriding each other's session during app initialization dataUpdater.initialized(); - viewModelMap["uiStateViewModel"].loading(false); }); };