From 23caf8b96fbfbc3209ca51ef4d83c6cbc13b5288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 19 Jul 2022 11:53:15 +0000 Subject: [PATCH] [IMP] web: update owl from 2.0.0-beta-12 to 2.0.0-beta-14 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release notes: https://github.com/odoo/owl/releases/tag/v2.0.0-beta-14 Details: - [FIX] compiler: better handle update of properties with same value closes odoo/odoo#95804 Related: odoo/enterprise#29350 Signed-off-by: Samuel Degueldre Signed-off-by: Géry Debongnie --- addons/web/static/lib/owl/owl.js | 15 ++++++++++----- .../static/src/core/autocomplete/autocomplete.js | 2 ++ .../static/src/core/autocomplete/autocomplete.xml | 2 +- .../src/views/view_dialogs/export_data_dialog.js | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/addons/web/static/lib/owl/owl.js b/addons/web/static/lib/owl/owl.js index c82af9d3b52..99397b0503f 100644 --- a/addons/web/static/lib/owl/owl.js +++ b/addons/web/static/lib/owl/owl.js @@ -217,7 +217,7 @@ function makePropSetter(name) { return function setProp(value) { // support 0, fallback to empty string for other falsy values - this[name] = value === 0 ? 0 : value || ""; + this[name] = value === 0 ? 0 : value ? value.valueOf() : ""; }; } function isProp(tag, key) { @@ -3906,13 +3906,18 @@ attrs["block-attribute-" + idx] = attrName; } else if (key.startsWith("t-att")) { + attrName = key === "t-att" ? null : key.slice(6); expr = compileExpr(ast.attrs[key]); + if (attrName && isProp(ast.tag, attrName)) { + // we force a new string or new boolean to bypass the equality check in blockdom when patching same value + const C = attrName === "value" ? "String" : "Boolean"; + expr = `new ${C}(${expr})`; + } const idx = block.insertData(expr, "attr"); if (key === "t-att") { attrs[`block-attributes`] = String(idx); } else { - attrName = key.slice(6); attrs[`block-attribute-${idx}`] = attrName; } } @@ -5755,9 +5760,9 @@ See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration Object.defineProperty(exports, '__esModule', { value: true }); - __info__.version = '2.0.0-beta-12'; - __info__.date = '2022-06-29T09:13:44.802Z'; - __info__.hash = '6c72e0a'; + __info__.version = '2.0.0-beta-14'; + __info__.date = '2022-07-08T14:18:04.914Z'; + __info__.hash = 'd111845'; __info__.url = 'https://github.com/odoo/owl'; diff --git a/addons/web/static/src/core/autocomplete/autocomplete.js b/addons/web/static/src/core/autocomplete/autocomplete.js index baff6bd6b4d..549a3c5d145 100644 --- a/addons/web/static/src/core/autocomplete/autocomplete.js +++ b/addons/web/static/src/core/autocomplete/autocomplete.js @@ -18,6 +18,7 @@ export class AutoComplete extends Component { optionsRev: 0, open: false, activeSourceOption: null, + value: this.props.value, }); this.inputRef = useRef("input"); @@ -31,6 +32,7 @@ export class AutoComplete extends Component { owl.onWillUpdateProps((nextProps) => { if (this.props.value !== nextProps.value || this.forceValFromProp) { this.forceValFromProp = false; + this.state.value = nextProps.value; this.inputRef.el.value = nextProps.value; this.close(); } diff --git a/addons/web/static/src/core/autocomplete/autocomplete.xml b/addons/web/static/src/core/autocomplete/autocomplete.xml index 2654ff87029..50baa6a968a 100644 --- a/addons/web/static/src/core/autocomplete/autocomplete.xml +++ b/addons/web/static/src/core/autocomplete/autocomplete.xml @@ -8,7 +8,7 @@ t-att-id="props.id" class="o-autocomplete--input o_input" t-att-placeholder="props.placeholder" - t-att-value="props.value" + t-model="state.value" t-on-blur="onInputBlur" t-on-click="onInputClick" t-on-change="onInputChange" diff --git a/addons/web/static/src/views/view_dialogs/export_data_dialog.js b/addons/web/static/src/views/view_dialogs/export_data_dialog.js index ff71dcc5f27..9ddcb27e749 100644 --- a/addons/web/static/src/views/view_dialogs/export_data_dialog.js +++ b/addons/web/static/src/views/view_dialogs/export_data_dialog.js @@ -183,7 +183,7 @@ export class ExportDataDialog extends Component { } async loadExportList(value) { - this.state.templateId = value; + this.state.templateId = value === "new_template" ? value : Number(value); this.state.isEditingTemplate = value === "new_template"; if (!value || value === "new_template") { return;