vuex-electron
vuex-electron copied to clipboard
Remove "don't use direct commit's" trap
Hi there,
Thanks for the lib. It seems from the source code there is a lot to do to get Vuex working nicely with Electron!
One thing I think is too much though, is the trap to prevent commits outside of stores:
https://github.com/vue-electron/vuex-electron/blob/master/src/shared-mutations.js#L54-L56
Surely it's not this library's place to decide on individual developer preference. Committing outside of actions is perfectly valid, especially for those who choose not to tightly couple their API to Vuex (like me!).
Can this be removed please?
Hello, Yes, indeed it cause some incompatibility with plugin like this one for instance: https://github.com/spacebro/spacebro-client
Or maybe do you have a proposal @MrEmelianenko ?
Hello @MrEmelianenko any thought about this issue ? Why not a warning and let the default behaviour happen.
https://github.com/vue-electron/vuex-electron/issues/44
Based on my understanding of vuex-electron, the single source of truth should be based in the main node process. This is accomplished right now by having the renderer dispatch actions, and the main process performing the commits...
I think mutations could be triggered on the renderer too, using ipcRenderer.sendSync
but that would obviously be blocking. IMO that's a fair trade for not dispatching actions which are async by design. I think it's actually the only way to consistently maintain keep the main state and renderer state(s) in sync.
@gabrielstuff @davestewart what do you think about that option? I'm working on a fork of this project and will be trying it out.
(forgot to tag in original comment, not sure if github will notify if I add it in an edit)