Persist actions log time display settings in localStorage (#36623)

Persist the two boolean settings in the actions log into `localStorage`
so that they are remembered across page reloads.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
silverwind
2026-02-15 20:41:59 +01:00
committed by GitHub
parent a6282c98d7
commit 26bb175d69
2 changed files with 17 additions and 9 deletions

View File

@@ -58,8 +58,8 @@ export const localUserSettings = {
getJsonObject: <T extends Record<string, any>>(key: string, def: T): T => {
const value = getLocalStorageUserSetting(key);
try {
const decoded = value !== null ? JSON.parse(value) : def;
return decoded ?? def;
const decoded = value !== null ? JSON.parse(value) : null;
return {...def, ...decoded};
} catch (e) {
console.error(`Unable to parse JSON value for local user settings ${key}=${value}`, e);
}