mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
fix: Safely retrieve settings from LocalStorage
This commit is contained in:
parent
f568389235
commit
f30428754f
@ -81,9 +81,17 @@
|
||||
});
|
||||
|
||||
if (userSettings) {
|
||||
await settings.set(userSettings.ui);
|
||||
settings.set(userSettings.ui);
|
||||
} else {
|
||||
await settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
|
||||
let localStorageSettings = {} as Parameters<(typeof settings)['set']>[0];
|
||||
|
||||
try {
|
||||
localStorageSettings = JSON.parse(localStorage.getItem('settings') ?? '{}');
|
||||
} catch (e: unknown) {
|
||||
console.error('Failed to parse settings from localStorage', e);
|
||||
}
|
||||
|
||||
settings.set(localStorageSettings);
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
|
Loading…
Reference in New Issue
Block a user