Skip to content

Commit

Permalink
Fix Storage Error by while loop and add proper global errorHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Gkiokan committed Jan 8, 2022
1 parent 29cfdac commit 64225f6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@
"output": "release"
},
"win": {
"target": ["zip", "portable"]
"target": [
"zip",
"portable"
]
},
"portable": {
"artifactName": "${productName}.exe",
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ styles.innerText=`@import url(https://unpkg.com/spectre.css/dist/spectre.min.css

Vue.config.devtools = process.env.NODE_ENV !== 'production',
Vue.config.productionTip = false,
Vue.config.errorHandler = (error, vm, info) => {
alert("Application global errorHandler:\n" + error)
}

new Vue({
router,
Expand Down
39 changes: 28 additions & 11 deletions src/renderer/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,31 @@ const modules = requireContext.keys()
return { ...modules, [name]: module }
}, {})

export default new Vuex.Store({
plugins: [
pathify.plugin,
createPersistedState({
throttle: 3300,
whitelist: (mutation) => true,
}),
createSharedMutations()
],
modules
})
function createStore(){
return new Vuex.Store({
plugins: [
pathify.plugin,
createPersistedState({
throttle: 1000,
whitelist: (mutation) => true,
}),
createSharedMutations()
],
modules
})
}

let store

while(store === undefined){
try {
store = createStore()
break;
}
catch(e){
// alert("Error in Store, guess race condition. Recreating Storage." + e)
continue;
}
}

export default store

0 comments on commit 64225f6

Please sign in to comment.