Merge pull request #18324 from ShirasawaSama/patch-37

fix: Fix missing model auto-pull when user settings are unmodified
This commit is contained in:
Tim Jaeryang Baek 2025-10-14 18:07:32 -05:00 committed by GitHub
commit 515e136502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,25 +85,27 @@
}
};
const setUserSettings = async (cb) => {
const userSettings = await getUserSettings(localStorage.token).catch((error) => {
const setUserSettings = async (cb: () => Promise<void>) => {
let userSettings = await getUserSettings(localStorage.token).catch((error) => {
console.error(error);
return null;
});
if (userSettings) {
await settings.set(userSettings.ui);
if (cb) {
await cb();
if (!userSettings) {
try {
userSettings = JSON.parse(localStorage.getItem('settings') ?? '{}');
} catch (e: unknown) {
console.error('Failed to parse settings from localStorage', e);
userSettings = {};
}
}
try {
return JSON.parse(localStorage.getItem('settings') ?? '{}');
} catch (e: unknown) {
console.error('Failed to parse settings from localStorage', e);
return {};
if (userSettings?.ui) {
settings.set(userSettings.ui);
}
if (cb) {
await cb();
}
};