Have a store with an action that takes a parameter
Use it via mapActions in a component
Observe the error in the js console
Expected behavior
When I have an action that takes parameters I expect the parameter to actually be handed through to the action so I can use it there.
Actual behavior
Instead of my expected parameter I get an object that looks to be the component I call the action from.
Additional information
When I use mapStores to get the whole store, then call my action via store it works perfectly well, just mapActions seems to have an issue. Might be just happening to me because I insist on using the options api, both for the store and for vue, but I would still expect it to work as intended.
PS: Coming over from vuex just now, I would appreciate if the documentation actually had an example on how to use an action with an argument. When I first encountered this issue it took me an hour to find out that yes, I am supposed to just put the parameter in the round brackets, instead of wrapping it in an object or something like I did in vuex. If that would have been in the documentation, then I could have ruled out me using the action wrongly far faster.
Reproduction
https://play.pinia.vuejs.org/#eNqNVMtu2zAQ/JUFL7ZRm0yQIgVcO3Aa5NAe2qIJcql6YMSNzYQiBZFSDBj+91KkXs4b0IHizg6Xs8vZkfM8p1WJZE4WNi1k7s4SLbPcFA52kPH8PHXSaDut11eOO2xWpkALe7grTAajXGrJR1/7zNJigLQAylJTaocFvbc1LtG4DUiBd7xUPiPRAKnJ8tKhmMdfAEppX8K4JZ3C3xEX4trccFXi6N9k+jZ658FzGKbsD1PCvQ7oq5eY46U73KSO7QMiQ7cxwnZ1+6NuJL8wAseBadIGANxGWtqX0sRjdB8YE+2/Beu64X8cZrnyNfo/gN0OQhLsA35xWzpnNKxSJdOHZUIG5MeThJydCwFGI4x7cSYLFrMC4UsMr6ZOoUDNMxTvc7QSvE5VSd5o9w5bMz1B96F6z6hjj4ZsCzZQj0xJHNGZx/pZNNoPfuhN0gRsQro2JiQMdr2TEBbWFG02uy3Mow2znJBmQhKy8q+ICaycMcrOeC5j2sa53M4ZS4X2eIFKVgXV6JjOM/YsZ3VKT+kxU/KW+YOY1AK3h8f4jJnA7CPsLXR1RI8/0y+BtTppSLOatZ03L4uzqdF3cv1ElPpJSoXFrzy07EAcrpR5/BH2XFFiV2K6wfThhf17u41V//YtwqLCwbUcL9boYvjy6idu/boLZkaUyqPfCP5Ba1RZ1xhh30otfNkDXKj2e+ix1Otre7l1qG17qbrQ/j0HmS/euHpf7gk9GajYu5yXsLNRb3JSR9N4YpkDJ/TyWwetucBymDUeNcQj72b1cbZ2rDmMJ7A8g3FTVnCFORyFeqJ18fjShsbUPh1n/LsZGFN9vlFIlVk3sQPLipbzaQkh9sSvPJTs/wPhYBn7
Steps to reproduce the bug
Expected behavior
When I have an action that takes parameters I expect the parameter to actually be handed through to the action so I can use it there.
Actual behavior
Instead of my expected parameter I get an object that looks to be the component I call the action from.
Additional information
When I use mapStores to get the whole store, then call my action via store it works perfectly well, just mapActions seems to have an issue. Might be just happening to me because I insist on using the options api, both for the store and for vue, but I would still expect it to work as intended.
PS: Coming over from vuex just now, I would appreciate if the documentation actually had an example on how to use an action with an argument. When I first encountered this issue it took me an hour to find out that yes, I am supposed to just put the parameter in the round brackets, instead of wrapping it in an object or something like I did in vuex. If that would have been in the documentation, then I could have ruled out me using the action wrongly far faster.