Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat null actions as mutation shorthands #25

Closed
skyrpex opened this issue Dec 23, 2015 · 2 comments
Closed

Treat null actions as mutation shorthands #25

skyrpex opened this issue Dec 23, 2015 · 2 comments

Comments

@skyrpex
Copy link

skyrpex commented Dec 23, 2015

Not sure if I explained myself in the title... For example:

// actions.js
export default {
  addMessage: 'addMessage', // This is the actual, which is OK.
  removeMessage: null, // This is equivalent to removeMessage: 'removeMessage'
};

This would allow to greatly simplify direct actions (at least to me). What do you think?

@blake-newman
Copy link
Member

To me i'd keep the action name with constant naming conventions ie:

// actions.js
export default {
  addMessage: 'ADD_MESSAGE', // This is the actual, which is OK.
  removeMessage: 'REMOVE_MESSAGE'
};

Perhaps mutations could be handled using an array that way you won't need to declare removeMessage to the same name but uppercase.

@yyx990803
Copy link
Member

No longer relevant as now all actions must be functions.

However you can create your own convenient action creator functions: https://github.com/vuejs/vuex/blob/master/examples/todomvc/vuex/actions.js#L1-L10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants