[Vue2] State as default Action parameters
See original GitHub issueSteps to reproduce the behavior
https://codesandbox.io/s/fast-river-jmtl3?file=/src/store.js
I was calling this action in a regular js
file.
Having state as default parameters gives a silent error. Had to debug to find out why the function was not getting called.
async fetchNotifications({page = this.notifications.page, limit = this.notifications.limit}) {
// fetch
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Actions | Vuex
Action handlers receive a context object which exposes the same set of methods/properties on the store instance, so you can call context. ......
Read more >Vuex - passing multiple parameters to mutation - Stack Overflow
I am not able to figure out how to send multiple parameters to the vuex mutation via an action. - store - export...
Read more >How To Manage State in a Vue.js Application with Vuex
These are the default values of firstName and lastName , respectively. Data from the Vuex store displayed in the view. In this step,...
Read more >How To Pass Data Between Components In Vue.js
Tip: Know the Default Getter Arguments # By default, Vuex getters accept two arguments. state — the state object for our application; getters...
Read more >Only one parameter works when dispatching actions. #366
I have some actions in my existing code base on the version 1.x of Vuex where I dispatch actions with multiple parameters.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah yeah, this is not related to Pinia, it’s about optional parameters with destructuring. This is the correct version:
I will need a boiled down repro to check further. You can use the demo codesandbox