You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to Vuex code, wrappedActionHandler function provide two params.One is payload,the other is cb.
// notice the cbentry.push(functionwrappedActionHandler(payload,cb){letres=handler.call(store,{dispatch: local.dispatch,commit: local.commit,getters: local.getters,state: local.state,rootGetters: store.getters,rootState: store.state},payload,cb)// pass it and do nothingif(!isPromise(res)){res=Promise.resolve(res)}if(store._devtoolHook){returnres.catch(err=>{store._devtoolHook.emit('vuex:error',err)throwerr})}else{returnres}})// dispatch function only use payloaddispatch(_type,_payload){// check object-style dispatchconst{
type,
payload
}=unifyObjectStyle(_type,_payload)constaction={ type, payload }constentry=this._actions[type]// ...constresult=entry.length>1
? Promise.all(entry.map(handler=>handler(payload)))// only payload parameter
: entry[0](payload)}
So I think cb parameter is useless and it should be delete from code in order to
eliminate misunderstanding.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Version
3.1.1
Reproduction link
https://codesandbox.io/s/vue-template-4fv3d
Steps to reproduce
What is expected?
In theory,it should show the code of cb.
What is actually happening?
In fact,it's undefined.
According to
Vuex
code,wrappedActionHandler
function provide two params.One ispayload
,the other iscb
.So I think
cb
parameter is useless and it should be delete from code in order toeliminate misunderstanding.
The text was updated successfully, but these errors were encountered: