[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) <qsm@odoo.com>
This commit is contained in:
Samuel Degueldre
2020-02-10 13:48:40 +00:00
parent 574bf9bb12
commit 99427c2c5a
@@ -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);
});