Skip to content

Commit ac8a486

Browse files
committed
[build] 3.1.3
1 parent 810a360 commit ac8a486

File tree

6 files changed

+42
-34
lines changed

6 files changed

+42
-34
lines changed

dist/vuex.common.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* vuex v3.1.2
3-
* (c) 2019 Evan You
2+
* vuex v3.1.3
3+
* (c) 2020 Evan You
44
* @license MIT
55
*/
66
'use strict';
@@ -394,7 +394,10 @@ Store.prototype.commit = function commit (_type, _payload, _options) {
394394
handler(payload);
395395
});
396396
});
397-
this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); });
397+
398+
this._subscribers
399+
.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
400+
.forEach(function (sub) { return sub(mutation, this$1.state); });
398401

399402
if (
400403
process.env.NODE_ENV !== 'production' &&
@@ -426,6 +429,7 @@ Store.prototype.dispatch = function dispatch (_type, _payload) {
426429

427430
try {
428431
this._actionSubscribers
432+
.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
429433
.filter(function (sub) { return sub.before; })
430434
.forEach(function (sub) { return sub.before(action, this$1.state); });
431435
} catch (e) {
@@ -794,9 +798,7 @@ function enableStrictMode (store) {
794798
}
795799

796800
function getNestedState (state, path) {
797-
return path.length
798-
? path.reduce(function (state, key) { return state[key]; }, state)
799-
: state
801+
return path.reduce(function (state, key) { return state[key]; }, state)
800802
}
801803

802804
function unifyObjectStyle (type, payload, options) {
@@ -1039,7 +1041,7 @@ function getModuleByNamespace (store, helper, namespace) {
10391041
var index = {
10401042
Store: Store,
10411043
install: install,
1042-
version: '3.1.2',
1044+
version: '3.1.3',
10431045
mapState: mapState,
10441046
mapMutations: mapMutations,
10451047
mapGetters: mapGetters,

dist/vuex.esm.browser.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* vuex v3.1.2
3-
* (c) 2019 Evan You
2+
* vuex v3.1.3
3+
* (c) 2020 Evan You
44
* @license MIT
55
*/
66
function applyMixin (Vue) {
@@ -382,7 +382,10 @@ class Store {
382382
handler(payload);
383383
});
384384
});
385-
this._subscribers.forEach(sub => sub(mutation, this.state));
385+
386+
this._subscribers
387+
.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
388+
.forEach(sub => sub(mutation, this.state));
386389

387390
if (
388391
options && options.silent
@@ -412,6 +415,7 @@ class Store {
412415

413416
try {
414417
this._actionSubscribers
418+
.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
415419
.filter(sub => sub.before)
416420
.forEach(sub => sub.before(action, this.state));
417421
} catch (e) {
@@ -769,9 +773,7 @@ function enableStrictMode (store) {
769773
}
770774

771775
function getNestedState (state, path) {
772-
return path.length
773-
? path.reduce((state, key) => state[key], state)
774-
: state
776+
return path.reduce((state, key) => state[key], state)
775777
}
776778

777779
function unifyObjectStyle (type, payload, options) {
@@ -996,7 +998,7 @@ function getModuleByNamespace (store, helper, namespace) {
996998
var index_esm = {
997999
Store,
9981000
install,
999-
version: '3.1.2',
1001+
version: '3.1.3',
10001002
mapState,
10011003
mapMutations,
10021004
mapGetters,

0 commit comments

Comments
 (0)