#1941 Add reload loop if settings fail to load
This commit is contained in:
parent
965bb54f7d
commit
a15ab86fd0
|
@ -3303,6 +3303,9 @@
|
||||||
<div id="ui_preset_export_button" class="menu_button menu_button_icon margin0" title="Export a theme file" data-i18n="[title]Export a theme file">
|
<div id="ui_preset_export_button" class="menu_button menu_button_icon margin0" title="Export a theme file" data-i18n="[title]Export a theme file">
|
||||||
<i class="fa-solid fa-file-export"></i>
|
<i class="fa-solid fa-file-export"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="ui-preset-delete-button" class="menu_button menu_button_icon margin0" title="Delete a theme" data-i18n="[title]Delete a theme" >
|
||||||
|
<i class="fa-solid fa-trash-can"></i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="file" id="ui_preset_import_file" accept=".json" hidden>
|
<input type="file" id="ui_preset_import_file" accept=".json" hidden>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
|
@ -842,12 +842,12 @@ async function firstLoadInit() {
|
||||||
throw new Error('Initialization failed');
|
throw new Error('Initialization failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await getClientVersion();
|
||||||
|
await getSettings();
|
||||||
getSystemMessages();
|
getSystemMessages();
|
||||||
sendSystemMessage(system_message_types.WELCOME);
|
sendSystemMessage(system_message_types.WELCOME);
|
||||||
initLocales();
|
initLocales();
|
||||||
await readSecretState();
|
await readSecretState();
|
||||||
await getClientVersion();
|
|
||||||
await getSettings();
|
|
||||||
await getUserAvatars(true, user_avatar);
|
await getUserAvatars(true, user_avatar);
|
||||||
await getCharacters();
|
await getCharacters();
|
||||||
await getBackgrounds();
|
await getBackgrounds();
|
||||||
|
@ -5771,6 +5771,16 @@ async function doOnboarding(avatarId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reloadLoop() {
|
||||||
|
const MAX_RELOADS = 5;
|
||||||
|
let reloads = Number(sessionStorage.getItem('reloads') || 0);
|
||||||
|
if (reloads < MAX_RELOADS) {
|
||||||
|
reloads++;
|
||||||
|
sessionStorage.setItem('reloads', String(reloads));
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//***************SETTINGS****************//
|
//***************SETTINGS****************//
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
async function getSettings() {
|
async function getSettings() {
|
||||||
|
@ -5782,7 +5792,8 @@ async function getSettings() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
toastr.error('Settings could not be loaded. Try reloading the page.');
|
reloadLoop();
|
||||||
|
toastr.error('Settings could not be loaded after multiple attempts. Please try again later.');
|
||||||
throw new Error('Error getting settings');
|
throw new Error('Error getting settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue