Skip to content

Instantly share code, notes, and snippets.

@incrize
Created October 30, 2019 12:14
Show Gist options
  • Save incrize/4edde5b4ad9256417ef105c603aeed79 to your computer and use it in GitHub Desktop.
Save incrize/4edde5b4ad9256417ef105c603aeed79 to your computer and use it in GitHub Desktop.
diff --git a/js/core/src/core/Tygh/plugins/object_picker/index.js b/js/core/src/core/Tygh/plugins/object_picker/index.js
index 61592784cb..7f165ce667 100644
--- a/js/core/src/core/Tygh/plugins/object_picker/index.js
+++ b/js/core/src/core/Tygh/plugins/object_picker/index.js
@@ -48,12 +48,12 @@ function init($elems, options) {
elemsMap[picker.options.objectType].push($elem);
}
+ });
- $.each(objectsMap, function (objectType, objectIds) {
- if (objectIds.size) {
- ObjectPicker.loadObjects($(elemsMap[objectType]), objectType, objectIds);
- }
- });
+ $.each(objectsMap, function (objectType, objectIds) {
+ if (objectIds.size) {
+ ObjectPicker.loadObjects($(elemsMap[objectType]), objectType, objectIds);
+ }
});
});
}
diff --git a/js/tygh/ajax.js b/js/tygh/ajax.js
index 0c73e70c02..0153275ca1 100644
--- a/js/tygh/ajax.js
+++ b/js/tygh/ajax.js
@@ -171,17 +171,14 @@
}
},
complete: function(XMLHttpRequest, textStatus) {
- activeQueries--;
- if (queryStack.length) {
- var f = queryStack.shift();
- f();
- }
+ methods.executeNext();
}
});
}
}
} else if (hash && responseCache[hash]) {
_response(responseCache[hash], params);
+ methods.executeNext();
}
return false;
@@ -259,8 +256,16 @@
response: function(response, params) {
return _response(response, params);
- }
+ },
+ executeNext: function () {
+ activeQueries--;
+
+ if (queryStack.length) {
+ var f = queryStack.shift();
+ f();
+ }
+ }
};
/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment