From 99427c2c5a44d3dd849b318fb3f580c3e9dd2d2a Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Mon, 10 Feb 2020 11:12:14 +0000 Subject: [PATCH] [FIX] web_editor: fix apply-to methods not being awaited When the apply-to data attribute was first introduced, a mistake was made when storing the results of the methods calls, using _.each instead of _.map to associate each target element with the promise of the method execution, as a result, Promise.all would resolve immediately instead of waiting. While there are no currently documented bug caused by this, they are just waiting to happen. This commit fixes that. closes odoo/odoo#44988 X-original-commit: 32271be1f696c11b3e5157426b8f7c9efa93134b Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index f21cb7a80ff..38b3045040c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -2059,7 +2059,7 @@ const SnippetOptionWidget = Widget.extend({ if (params.applyTo) { const $subTargets = this.$(params.applyTo); - const proms = _.each($subTargets, subTargetEl => { + const proms = _.map($subTargets, subTargetEl => { const proxy = createPropertyProxy(this, '$target', $(subTargetEl)); return this[methodName].call(proxy, previewMode, widgetValue, params); });