Skip to content

Commit 83d7832

Browse files
committed
fix migration marking
1 parent af5a0b2 commit 83d7832

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/react/appStorageProvider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,12 @@ const markLocalStorageAsMigrated = (key: keyof StorageData) => {
312312
const data = localStorage.getItem(localStorageKey)
313313
if (data) {
314314
try {
315-
localStorage.setItem(localStorageKey, JSON.stringify({ ...JSON.parse(data), migrated: Date.now() }))
315+
const parsed = JSON.parse(data)
316+
localStorage.setItem(
317+
localStorageKey, JSON.stringify(typeof parsed === 'object' ? {
318+
...parsed, migrated: Date.now()
319+
} : { data: parsed, migrated: Date.now() })
320+
)
316321
} catch (err) {
317322
}
318323
}

0 commit comments

Comments
 (0)