Vuex mutation calling another mutation or a synchronous action instead? Vuex mutation calling another mutation or a synchronous action instead? vue.js vue.js

Vuex mutation calling another mutation or a synchronous action instead?


Your first example is the correct structure.

It's true that any asynchronous code related to your Vuex module should be held in the module's actions and not in its mutations. But, actions are not required to be asynchronous.

They can contain synchronous code related to the module. This way, as you said in your last example, components referencing the Vuex module don't need to be aware of that internal logic.