forked from AkkomaGang/akkoma-fe
Set state to loaded if it crashes while loading.
This commit is contained in:
parent
1ea19dcf1d
commit
40b607bdea
1 changed files with 16 additions and 11 deletions
|
@ -38,6 +38,7 @@ export default function createPersistedState ({
|
||||||
} = {}) {
|
} = {}) {
|
||||||
return store => {
|
return store => {
|
||||||
getState(key, storage).then((savedState) => {
|
getState(key, storage).then((savedState) => {
|
||||||
|
try {
|
||||||
if (typeof savedState === 'object') {
|
if (typeof savedState === 'object') {
|
||||||
// build user cache
|
// build user cache
|
||||||
const usersState = savedState.users || {}
|
const usersState = savedState.users || {}
|
||||||
|
@ -51,6 +52,10 @@ export default function createPersistedState ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
loaded = true
|
loaded = true
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Couldn't load state")
|
||||||
|
loaded = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
subscriber(store)((mutation, state) => {
|
subscriber(store)((mutation, state) => {
|
||||||
|
|
Loading…
Reference in a new issue