Skip to content

Commit

Permalink
Only reset splash screen state on server changes, reset loading attem…
Browse files Browse the repository at this point in the history
…pts correctly.
  • Loading branch information
JLyne committed Sep 1, 2021
1 parent 78655e7 commit ab5ede1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -186,6 +186,7 @@ export default defineComponent({
return;
}
loadingAttempts.value = 0;
window.history.replaceState({}, '', newServer.id);
loadConfiguration();
}, {deep: true});
Expand Down
20 changes: 11 additions & 9 deletions src/util/splash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ab5ede1

Please sign in to comment.