diff options
Diffstat (limited to 'src/state')
-rw-r--r-- | src/state/persisted/store.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/state/persisted/store.ts b/src/state/persisted/store.ts index 421bdccdf..ca023a636 100644 --- a/src/state/persisted/store.ts +++ b/src/state/persisted/store.ts @@ -13,7 +13,13 @@ export async function write(value: Schema) { export async function read(): Promise<Schema | undefined> { const rawData = await AsyncStorage.getItem(BSKY_STORAGE) const objData = rawData ? JSON.parse(rawData) : undefined + + // new user + if (!objData) return undefined + + // existing user, validate const parsed = schema.safeParse(objData) + if (parsed.success) { return objData } else { |