Skip to content

Commit

Permalink
fix: incompatible with old data of userInfo, causing crash
Browse files Browse the repository at this point in the history
  • Loading branch information
molvqingtai committed Nov 4, 2024
1 parent 7e49ec2 commit d5ced07
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/domain/impls/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ export const IndexDBStorageImpl = IndexDBStorageExtern.impl({

export const BrowserSyncStorageImpl = BrowserSyncStorageExtern.impl({
name: STORAGE_NAME,
get: async (key) => JSONR.parse(await browserSyncStorage.getItem(key)),
get: async (key) => {
const value: any = await browserSyncStorage.getItem(key)
try {
return JSONR.parse(value)
} catch {
return value
}
},
set: (key, value) => browserSyncStorage.setItem(key, JSONR.stringify(value)),
remove: browserSyncStorage.removeItem,
clear: browserSyncStorage.clear,
Expand Down

0 comments on commit d5ced07

Please sign in to comment.