Async Storage with localForage .restored not available.
See original GitHub issueCurrently, we have an older project that we are migrating from javascript to typescript. Implemented typescript router but still using javascript store. Tried npm install @types/vuex-persist with no such package available.
Ended up adding vuex-persist.d.ts, which solved the problem:
import Vue, { VNode } from 'vue'
import { Store } from 'vuex'
declare module 'vuex' {
export interface Store<S> {
restored: Promise<S>
}
}
Is there a possibility to include types for future users that may experience the same problem?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
React native async storage issues - Stack Overflow
Try using JSON.parse() when getting and JSON.stringify() when setting it.
Read more >How to use the localforage.setDriver function in ... - Snyk
setDriver('objectStorage') const vuexPersist = new VuexPersistence<any>({ key: 'restored_test', asyncStorage: true, storage: localForage, reducer: (state) ...
Read more >Cory House on Twitter: "Just learned about localforage - Twitter
Just learned about localforage - An npm package that makes it easy to store data ... Async/await Unlike localStorage, you can store any...
Read more >@feathersjs-offline/client - npm
There are no other projects in the npm registry using ... stores data in localStorage in the browser or AsyncStorage in React Native....
Read more >How to Use localForage for Easy Async Browser Storage
IndexedDB; WebSQL; localStorage. It will gracefully degrade if that database isn't available. For example, WebSQL isn't available on Firefox ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same issue here, temporary fixed it like so:
This stopped working for some reason, but I got it back by doing
await (store as any).original.restored;
in my router guardand
restoreState: key => localForage.getItem(key),
inconst vuexLocalForage = new VuexPersistence<RootState>({