From fdc8bc171108c6d97b9f73ad9dc5ebeea1860d56 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 10 Aug 2017 11:36:49 +0200 Subject: [PATCH] [FIX] web: resolve `ajax.loadXML` deferred at the proper time There was a problem with the new `ajax.loadXML` implementation introduced with 417a664f16abc67bee40a0067103f9cf2c412aed Indeed the following case was buggy: ``` ajax.loadXML('URL1', qweb); ajax.loadXML().then(function () { ajax.loadXML('URL2', qweb); }); ``` With this code, 'URL2' is scheduled to be loaded when 'URL1' is fully loaded. The problem is that the deferred returned by the call to `ajax.loadXML` without argument was resolved before the internal `isLoading` variable was reset to `false`. So, the loading of 'URL2' was indeed scheduled when 'URL1' was fully loaded but its loading never started because the `ajax.loadXML` loading loop was still marked as running (so it was not started again as it should have been). --- addons/web/static/src/js/core/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/core/ajax.js b/addons/web/static/src/js/core/ajax.js index b56823c4e6f..63ee1f47c40 100644 --- a/addons/web/static/src/js/core/ajax.js +++ b/addons/web/static/src/js/core/ajax.js @@ -426,8 +426,8 @@ var loadXML = (function () { } else { // There is nothing to load anymore, so resolve the // "all the calls" deferred - allLoadingsDef.resolve(); isLoading = false; + allLoadingsDef.resolve(); } } };