From ab5ede1cccd4de83673a7e42cf456d5547c66a03 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Wed, 1 Sep 2021 18:14:19 +0100 Subject: [PATCH] Only reset splash screen state on server changes, reset loading attempts correctly. --- src/App.vue | 3 ++- src/util/splash.ts | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/App.vue b/src/App.vue index 424df36..adc2e46 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,7 +71,7 @@ export default defineComponent({ loadConfiguration = async () => { try { clearTimeout(loadingTimeout); - showSplash(); + showSplash(!loadingAttempts.value); loading.value = true; await store.dispatch(ActionTypes.STOP_UPDATES, undefined); @@ -186,6 +186,7 @@ export default defineComponent({ return; } + loadingAttempts.value = 0; window.history.replaceState({}, '', newServer.id); loadConfiguration(); }, {deep: true}); diff --git a/src/util/splash.ts b/src/util/splash.ts index f356e6a..31b9b6b 100644 --- a/src/util/splash.ts +++ b/src/util/splash.ts @@ -21,21 +21,23 @@ const app = document.getElementById('app'), splashErrorMessage = document.getElementById('splash__error-message'), splashRetry = document.getElementById('splash__error-retry'); -export const showSplash = function() { +export const showSplash = function(reset: boolean) { if(!splash || !app) { return; } - if(splashError) { - splashError.setAttribute('aria-hidden', 'true'); - } + if(reset) { + if(splashError) { + splashError.setAttribute('aria-hidden', 'true'); + } - if(splashSpinner) { - splashSpinner.style.visibility = 'visible'; - } + if(splashSpinner) { + splashSpinner.style.visibility = 'visible'; + } - if(splashRetry) { - splashRetry.hidden = true; + if(splashRetry) { + splashRetry.hidden = true; + } } splash.hidden = false;