mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-20 14:10:39 +01:00
#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">
|
||||
<i class="fa-solid fa-file-export"></i>
|
||||
</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>
|
||||
<input type="file" id="ui_preset_import_file" accept=".json" hidden>
|
||||
</h4>
|
||||
|
@ -842,12 +842,12 @@ async function firstLoadInit() {
|
||||
throw new Error('Initialization failed');
|
||||
}
|
||||
|
||||
await getClientVersion();
|
||||
await getSettings();
|
||||
getSystemMessages();
|
||||
sendSystemMessage(system_message_types.WELCOME);
|
||||
initLocales();
|
||||
await readSecretState();
|
||||
await getClientVersion();
|
||||
await getSettings();
|
||||
await getUserAvatars(true, user_avatar);
|
||||
await getCharacters();
|
||||
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****************//
|
||||
///////////////////////////////////////////
|
||||
async function getSettings() {
|
||||
@ -5782,7 +5792,8 @@ async function getSettings() {
|
||||
});
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user