about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-06-10 15:00:45 -0500
committerGitHub <noreply@github.com>2024-06-10 22:00:45 +0200
commit7356763e4965f4bd4b7c5de91b78a19f97b259b3 (patch)
tree6b8d5b96724f36715bf7d5fea558431115ddf235
parent5dd195bcb748820eb293348501348d658021c658 (diff)
downloadvoidsky-7356763e4965f4bd4b7c5de91b78a19f97b259b3.tar.zst
Only validate persisted data for existing users (#4465)
-rw-r--r--src/state/persisted/store.ts6
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 {