-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Compatibility with localForage #55
base: master
Are you sure you want to change the base?
Conversation
src/index.ts
Outdated
} | ||
|
||
const parseState = (toParse: string) => { | ||
const parseState = (toParse: string | null | undefined): PersistState => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should change this to PersistItemValue
Hello.
|
Skipping onSet only on the first load as shown below worked as expected, but I am not very confident that it is a good method.
|
050c87f
to
2f70d34
Compare
localForage
is incompatible withrecoil-storage
, return types are different.localForage.getItem()
returnsPromise<null|string>
. which makes getState return null, as there is no check fornull
from a promise.localForage.setItem()
returnsPromise<string>
. butrecoil-storage
doesn't care about that anyway, so doesn't have to enforce those types.Making getState return a Promise always simplifies the code a lot, though that commit doesn't need to be part of this, but it better enforces the types.