fix(packages): fix the parsing logic for stored data to ensure correct return of boolean values

This commit is contained in:
Cell 2025-07-25 17:59:09 +08:00 committed by 青菜白玉汤
parent 87adc35f2e
commit 9ea56c9b82

View File

@ -32,7 +32,8 @@ export function createStorage<T extends object>(type: StorageType, storagePrefix
storageData = JSON.parse(json); storageData = JSON.parse(json);
} catch {} } catch {}
if (storageData) { // storageData may be `false` if it is boolean type
if (storageData !== null) {
return storageData as T[K]; return storageData as T[K];
} }
} }