mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-23 11:09:43 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user