vuex-electron icon indicating copy to clipboard operation
vuex-electron copied to clipboard

Remove "don't use direct commit's" trap

Open davestewart opened this issue 5 years ago • 5 comments

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?

davestewart avatar Dec 26 '18 14:12 davestewart

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 ?

gabrielstuff avatar Jan 02 '19 17:01 gabrielstuff

Hello @MrEmelianenko any thought about this issue ? Why not a warning and let the default behaviour happen.

gabrielstuff avatar Jan 21 '19 13:01 gabrielstuff

https://github.com/vue-electron/vuex-electron/issues/44

akodkod avatar Aug 29 '19 14:08 akodkod

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.

ferm10n avatar Jun 20 '21 02:06 ferm10n

@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)

ferm10n avatar Jun 20 '21 02:06 ferm10n