Skip to content

Commit

Permalink
Restore Issue 8 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marionnewlevant committed May 13, 2019
1 parent ce743dd commit d972d9f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/assetbundles/snitch/dist/js/snitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ var globalPollInterval = null;
var globalMessage = null;
var globalInputIdSelectors = null;

// only one Craft.postActionRequest at a time (https://github.com/marionnewlevant/craft-snitch/issues/8)
var g_lastActionRequest = null;

var currentWarnings = function($warnContainer) {
var $warnings = $warnContainer.children('div');
var ret = {};
Expand Down Expand Up @@ -84,15 +87,17 @@ var lookForEditForms = function() {
// our modal is gone.
if (intervalId) { window.clearInterval(intervalId); }
} else {
Craft.postActionRequest(
'snitch/collision/ajax-enter',
{snitchId: snitchId, snitchType: snitchType},
function(response, textStatus) {
if (textStatus == 'success' && response && response['collisions'].length) {
warn(snitchId, $warnContainer, response['collisions']);
if (!g_lastActionRequest || g_lastActionRequest.status) {
g_lastActionRequest = Craft.postActionRequest(
'snitch/collision/ajax-enter',
{snitchId: snitchId, snitchType: snitchType},
function(response, textStatus) {
if (textStatus == 'success' && response && response['collisions'].length) {
warn(snitchId, $warnContainer, response['collisions']);
}
}
}
);
);
}
}
};

Expand Down

0 comments on commit d972d9f

Please sign in to comment.