Set state to loaded if it crashes while loading.

This commit is contained in:
Roger Braun 2017-04-09 22:15:35 +02:00
parent 1ea19dcf1d
commit 40b607bdea

View file

@ -38,6 +38,7 @@ export default function createPersistedState ({
} = {}) {
return store => {
getState(key, storage).then((savedState) => {
try {
if (typeof savedState === 'object') {
// build user cache
const usersState = savedState.users || {}
@ -51,6 +52,10 @@ export default function createPersistedState ({
)
}
loaded = true
} catch (e) {
console.log("Couldn't load state")
loaded = true
}
})
subscriber(store)((mutation, state) => {