[FIX] web: returns right deferred when loading same xml twice in a row
Since commit 417a664f16:
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.
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user