File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -62,14 +62,12 @@ class Store {
62
62
63
63
commit ( type , payload , options ) {
64
64
// check object-style commit
65
- let mutation
66
65
if ( isObject ( type ) && type . type ) {
67
66
options = payload
68
- payload = mutation = type
67
+ payload = type
69
68
type = type . type
70
- } else {
71
- mutation = { type, payload }
72
69
}
70
+ const mutation = { type, payload }
73
71
const entry = this . _mutations [ type ]
74
72
if ( ! entry ) {
75
73
console . error ( `[vuex] unknown mutation type: ${ type } ` )
Original file line number Diff line number Diff line change @@ -674,8 +674,8 @@ describe('Vuex', () => {
674
674
expect ( mutations . length ) . toBe ( 2 )
675
675
expect ( mutations [ 0 ] . type ) . toBe ( TEST )
676
676
expect ( mutations [ 1 ] . type ) . toBe ( TEST )
677
- expect ( mutations [ 0 ] . payload . n ) . toBe ( 1 ) // normal dispatch
678
- expect ( mutations [ 1 ] . n ) . toBe ( 2 ) // object dispatch
677
+ expect ( mutations [ 0 ] . payload . n ) . toBe ( 1 ) // normal commit
678
+ expect ( mutations [ 1 ] . payload . n ) . toBe ( 2 ) // object commit
679
679
} )
680
680
681
681
it ( 'strict mode: warn mutations outside of handlers' , function ( ) {
You can’t perform that action at this time.
0 commit comments