summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-08-04 18:02:17 +0200
committerqsm-odoo <qsm@odoo.com>2017-08-08 14:31:59 +0200
commit24c6e98685a67a507f69a6f8ceebbb29302efa9c (patch)
treec26c01ac99cede4ebda56f8e516ae8e8cae8e813 /addons/web/static/src/js/core
parentcfdc76d758adbf8fded99a9d6c5771aa7e240139 (diff)
[FIX] web: returns right deferred when loading same xml twice in a row
Since commit 417a664f16abc67bee40a0067103f9cf2c412aed: The `ajax.loadXML` function has been refactored and improved so that multiple calls to the function with the same URL only loads it once and so that the deferred which is returned really indicates the status of loading this particular URL. Unfortunately, there was a mistake: when loading the same URL twice, the second call always returned an already resolved deferred if the first call to `ajax.loadXML` was done with this URL.
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/ajax.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web/static/src/js/core/ajax.js b/addons/web/static/src/js/core/ajax.js
index 2b4b480ac50..b56823c4e6f 100644
--- a/addons/web/static/src/js/core/ajax.js
+++ b/addons/web/static/src/js/core/ajax.js
@@ -415,8 +415,11 @@ var loadXML = (function () {
if (loadingsData.length) {
// There is something to load, load it, resolve the associated
// deferred then start loading the next one
- var loadingData = loadingsData.shift();
+ var loadingData = loadingsData[0];
loadingData.qweb.add_template(loadingData.url, function () {
+ // Remove from array only now so that multiple calls to
+ // loadXML with the same URL returns the right deferred
+ loadingsData.shift();
loadingData.def.resolve();
_load();
});