mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-21 15:01:03 +00:00
Enhance settings persistence: add error handling for storage operations to ensure in-memory updates are applied even when storage quota is exceeded or restricted.
This commit is contained in:
@@ -319,8 +319,11 @@ function persistSettings(next: UiSettings) {
|
||||
...(next.locale ? { locale: next.locale } : {}),
|
||||
};
|
||||
const serialized = JSON.stringify(persisted);
|
||||
storage?.setItem(scopedKey, serialized);
|
||||
// Keep the legacy unscoped key in sync for older readers and migration tests,
|
||||
// but never include the session token in persistent storage.
|
||||
storage?.setItem(LEGACY_SETTINGS_KEY, serialized);
|
||||
try {
|
||||
storage?.setItem(scopedKey, serialized);
|
||||
storage?.setItem(LEGACY_SETTINGS_KEY, serialized);
|
||||
} catch {
|
||||
// best-effort — quota exceeded or security restrictions should not
|
||||
// prevent in-memory settings and visual updates from being applied
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user