Unlike the useStorageAsync function in VueUse, instead, an exception would be thrown and the default value was not written into the storage in UniApp if the data didn't present initially.
I think it is because the line 217 throws the exception mentioned above rather than return a null value which leads the next line rawValue == null comparation makes no sense.
Reproduction
import { useStorageAsync } from '@uni-helper/uni-use'
const test = useStorageAsync('test', 'default-value') // throws exception
console.log(test.value)
Describe the bug
Unlike the
useStorageAsync
function inVueUse
, instead, an exception would be thrown and the default value was not written into the storage in UniApp if the data didn't present initially.https://github.com/uni-helper/uni-use/blob/974e6063713a640d33f7c5ad2c0d64a9e9d7775c/src/useStorageAsync/index.ts#L215-L241
I think it is because the line 217 throws the exception mentioned above rather than return a
null
value which leads the next linerawValue == null
comparation makes no sense.Reproduction
System Info
Used Package Manager
yarn
Validations