File tree Expand file tree Collapse file tree 2 files changed +1
-51
lines changed Expand file tree Collapse file tree 2 files changed +1
-51
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ class Store {
23
23
this . _wrappedGetters = Object . create ( null )
24
24
this . _runtimeModules = Object . create ( null )
25
25
this . _subscribers = [ ]
26
- this . _pendingActions = [ ]
27
26
28
27
// bind commit and dispatch to self
29
28
const store = this
@@ -89,15 +88,9 @@ class Store {
89
88
console . error ( `[vuex] unknown action type: ${ type } ` )
90
89
return
91
90
}
92
- const res = entry . length > 1
91
+ return entry . length > 1
93
92
? Promise . all ( entry . map ( handler => handler ( payload ) ) )
94
93
: entry [ 0 ] ( payload )
95
- const pending = this . _pendingActions
96
- pending . push ( res )
97
- return res . then ( value => {
98
- pending . splice ( pending . indexOf ( res ) , 1 )
99
- return value
100
- } )
101
94
}
102
95
103
96
subscribe ( fn ) {
@@ -163,10 +156,6 @@ class Store {
163
156
resetStore ( this )
164
157
}
165
158
166
- onActionsResolved ( cb ) {
167
- Promise . all ( this . _pendingActions ) . then ( cb )
168
- }
169
-
170
159
_withCommit ( fn ) {
171
160
const committing = this . _committing
172
161
this . _committing = true
Original file line number Diff line number Diff line change @@ -129,45 +129,6 @@ describe('Vuex', () => {
129
129
} )
130
130
} )
131
131
132
- it ( 'onActionsResolved' , done => {
133
- const store = new Vuex . Store ( {
134
- state : {
135
- count : 0
136
- } ,
137
- mutations : {
138
- inc : state => state . count ++
139
- } ,
140
- actions : {
141
- one ( { commit } ) {
142
- return new Promise ( r => {
143
- commit ( 'inc' )
144
- r ( 1 )
145
- } )
146
- } ,
147
- two ( { commit } ) {
148
- return new Promise ( r => {
149
- setTimeout ( ( ) => {
150
- commit ( 'inc' )
151
- r ( 2 )
152
- } , 0 )
153
- } )
154
- }
155
- }
156
- } )
157
- store . dispatch ( 'one' )
158
- store . dispatch ( 'two' )
159
- expect ( store . state . count ) . toBe ( 1 )
160
- expect ( store . _pendingActions . length ) . toBe ( 2 )
161
- store . onActionsResolved ( res => {
162
- expect ( store . _pendingActions . length ) . toBe ( 0 )
163
- expect ( store . state . count ) . toBe ( 2 )
164
- expect ( res . length ) . toBe ( 2 )
165
- expect ( res [ 0 ] ) . toBe ( 1 )
166
- expect ( res [ 1 ] ) . toBe ( 2 )
167
- done ( )
168
- } )
169
- } )
170
-
171
132
it ( 'getters' , ( ) => {
172
133
const store = new Vuex . Store ( {
173
134
state : {
You can’t perform that action at this time.
0 commit comments