diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-04-03 13:33:44 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-04-10 11:54:02 +0000 |
| commit | cf85f3b082c49a21cfde0d04299a80724a40f420 (patch) | |
| tree | 2cb2a1cecb3296016aff8122a8528a28c4317e2a /addons/web/static/src/js/core/ajax.js | |
| parent | a7b9448033f9a340ff72c629390661d59de96c17 (diff) | |
[FIX] web: fix ajax.loadAsset cache
The caching system which was implemented was not working if the
same asset was asked twice "at the same time" = "if the second demand
occured while the first demand's RPC loading was taking place".
Part of https://github.com/odoo/odoo/pull/48981
X-original-commit: ba0ac348a3700331cec6955625ca2b6c72600ced
Diffstat (limited to 'addons/web/static/src/js/core/ajax.js')
| -rw-r--r-- | addons/web/static/src/js/core/ajax.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/web/static/src/js/core/ajax.js b/addons/web/static/src/js/core/ajax.js index 67a46e29d55..c48ae4c0254 100644 --- a/addons/web/static/src/js/core/ajax.js +++ b/addons/web/static/src/js/core/ajax.js @@ -441,7 +441,7 @@ var loadAsset = (function () { var load = function loadAsset(xmlId, context) { if (cache[xmlId]) { - return Promise.resolve(cache[xmlId]); + return cache[xmlId]; } context = _.extend({}, odoo.session_info.user_context, context); var params = { @@ -454,9 +454,9 @@ var loadAsset = (function () { method: 'render_template', model: 'ir.ui.view', }; - return rpc('/web/dataset/call_kw/ir.ui.view/render_template', params).then(function (xml) { + cache[xmlId] = rpc('/web/dataset/call_kw/ir.ui.view/render_template', params).then(function (xml) { var $xml = $(xml); - cache[xmlId] = { + return { cssLibs: $xml.filter('link[href]:not([type="image/x-icon"])').map(function () { return $(this).attr('href'); }).get(), @@ -470,8 +470,8 @@ var loadAsset = (function () { return $(this).html(); }).get(), }; - return cache[xmlId]; }); + return cache[xmlId]; }; return load; |
