()
| 136 | } |
| 137 | |
| 138 | function readPersistedState(): UiState { |
| 139 | if (typeof window === "undefined") { |
| 140 | return initialState; |
| 141 | } |
| 142 | try { |
| 143 | const raw = window.localStorage.getItem(PERSISTED_STATE_KEY); |
| 144 | if (!raw) { |
| 145 | for (const legacyKey of LEGACY_PERSISTED_STATE_KEYS) { |
| 146 | const legacyRaw = window.localStorage.getItem(legacyKey); |
| 147 | if (!legacyRaw) { |
| 148 | continue; |
| 149 | } |
| 150 | return parsePersistedState(JSON.parse(legacyRaw) as PersistedUiState); |
| 151 | } |
| 152 | return initialState; |
| 153 | } |
| 154 | return parsePersistedState(JSON.parse(raw) as PersistedUiState); |
| 155 | } catch { |
| 156 | return initialState; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | function sanitizePersistedThreadChangedFilesExpanded( |
| 161 | value: PersistedUiState["threadChangedFilesExpandedById"], |
no test coverage detected