From 7356763e4965f4bd4b7c5de91b78a19f97b259b3 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 10 Jun 2024 15:00:45 -0500 Subject: Only validate persisted data for existing users (#4465) --- src/state/persisted/store.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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 { 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 { -- cgit 1.4.1