vuex icon indicating copy to clipboard operation
vuex copied to clipboard

docs: add info about multiple args for action

Open estacet opened this issue 3 years ago • 3 comments

estacet avatar Apr 21 '21 21:04 estacet

Thanks for the PR. I think this is lay terms for what already exists. For example, read the following excerpt from the Action docs. Could I therefore ask what your interpretation of this is and whether this just duplicates what's already stated?

Actions support the same payload format and object-style dispatch

// dispatch with a payload
store.dispatch('incrementAsync', {
  amount: 10
})

// dispatch with an object
store.dispatch({
  type: 'incrementAsync',
  amount: 10
})

cuebit avatar Apr 21 '21 23:04 cuebit

Yeah, I think this addition is a little too much? But I do understand sometime people gets confused, or not sure how to pass multiple argument. So how about we add a note at here, stating that a 3rd argument will be ignored and if you want pass multiple arguments, users should pass an object or arrays.

We should do the same for mutations though.

kiaking avatar May 20 '21 16:05 kiaking

Explicitly stating that only one argument is accepted as a payload would especially help those who are explicitly looking for information at the Actions section of the docs (that is, using it as a reference, not reading the sections in order). It may also help developers who use English as their second language, and it would also make the docs more approachable for beginners.

zkriszti avatar Feb 02 '22 12:02 zkriszti