mirror of
https://github.com/open-webui/open-webui
synced 2025-01-18 00:30:51 +00:00
fix: Safely retrieve settings from LocalStorage
This commit is contained in:
parent
f568389235
commit
f30428754f
@ -81,9 +81,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (userSettings) {
|
if (userSettings) {
|
||||||
await settings.set(userSettings.ui);
|
settings.set(userSettings.ui);
|
||||||
} else {
|
} 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([
|
await Promise.all([
|
||||||
|
Loading…
Reference in New Issue
Block a user