MCPcopy
hub / github.com/pingdotgg/t3code / readPersistedState

Function readPersistedState

apps/web/src/uiStateStore.ts:138–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136}
137
138function 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
160function sanitizePersistedThreadChangedFilesExpanded(
161 value: PersistedUiState["threadChangedFilesExpandedById"],

Callers 1

uiStateStore.tsFile · 0.85

Calls 1

parsePersistedStateFunction · 0.85

Tested by

no test coverage detected