()
| 70 | } |
| 71 | |
| 72 | export function readPersistedUiState(): PersistedUiState { |
| 73 | if (typeof window === "undefined") { |
| 74 | return {}; |
| 75 | } |
| 76 | |
| 77 | try { |
| 78 | const parsed = JSON.parse( |
| 79 | window.localStorage.getItem(UI_STATE_STORAGE_KEY) ?? "{}", |
| 80 | ) as PersistedUiState; |
| 81 | return sanitizePersistedUiState(parsed); |
| 82 | } catch { |
| 83 | return {}; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | export function clearLegacyVolatileUiState(): void { |
| 88 | if (typeof window === "undefined") { |
no test coverage detected