Skip to content

Commit e3c7d1b

Browse files
committed
Resolved multiple clicks issue on MassAction functionality
1 parent d6407a2 commit e3c7d1b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

app/code/Magento/Ui/view/base/web/js/grid/massactions.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ define([
2727
modules: {
2828
selections: '${ $.selectProvider }'
2929
},
30-
clickedOnce: false,
30+
actionClicked: false,
3131
},
3232

3333
/**
@@ -49,10 +49,6 @@ define([
4949
* @returns {Massactions} Chainable.
5050
*/
5151
applyAction: function (actionIndex) {
52-
if (this.clickedOnce) {
53-
return this;
54-
}
55-
5652
var data = this.getSelections(),
5753
action,
5854
callback;
@@ -66,13 +62,24 @@ define([
6662
}
6763

6864
action = this.getAction(actionIndex);
65+
66+
if (action.actionClicked && !action.timeoutExpired) {
67+
return this;
68+
}
6969
callback = this._getCallback(action, data);
7070

7171
action.confirm ?
7272
this._confirm(action, callback) :
7373
callback();
74-
75-
this.clickedOnce = true;
74+
75+
this.actions().forEach(function (item) {
76+
item.actionClicked = (item.type === actionIndex);
77+
})
78+
79+
action.timeoutExpired = false;
80+
setTimeout(function () {
81+
action.timeoutExpired = true;
82+
}, 3000);
7683

7784
return this;
7885
},

0 commit comments

Comments
 (0)