From abaf9d0e70a480252afcf0e08f2a3c68fbbafa00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 20 Feb 2023 08:50:30 +0000 Subject: [PATCH] [IMP] web: update owl from v2.0.6 to v2.0.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update contains the following commit: - [FIX] compiler: t-key and t-ref together More details at: https://github.com/odoo/owl/releases/tag/v2.0.7 closes odoo/odoo#113385 X-original-commit: 1624282af36cd4b8ce228a3c47ed1de92cefa9c5 Signed-off-by: Aaron Bohy (aab) Signed-off-by: Géry Debongnie --- addons/web/static/lib/owl/owl.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/addons/web/static/lib/owl/owl.js b/addons/web/static/lib/owl/owl.js index 15c22c51b63..9631df940bd 100644 --- a/addons/web/static/lib/owl/owl.js +++ b/addons/web/static/lib/owl/owl.js @@ -3050,6 +3050,15 @@ } }; } + function singleRefSetter(refs, name) { + let _el = null; + return (el) => { + if (el || refs[name] === _el) { + refs[name] = el; + _el = el; + } + }; + } /** * Validate the component props (or next props) against the (static) props * description. This is potentially an expensive operation: it may needs to @@ -3098,6 +3107,7 @@ prepareList, setContextValue, multiRefSetter, + singleRefSetter, shallowEqual, toNumber, validateProps, @@ -4074,8 +4084,9 @@ this.target.hasRef = true; const isDynamic = INTERP_REGEXP.test(ast.ref); if (isDynamic) { + this.helpers.add("singleRefSetter"); const str = replaceDynamicParts(ast.ref, (expr) => this.captureExpression(expr, true)); - const idx = block.insertData(`(el) => refs[${str}] = el`, "ref"); + const idx = block.insertData(`singleRefSetter(refs, ${str})`, "ref"); attrs["block-ref"] = String(idx); } else { @@ -4090,7 +4101,8 @@ } else { let id = generateId("ref"); - this.target.refInfo[name] = [id, `(el) => refs[\`${name}\`] = el`]; + this.helpers.add("singleRefSetter"); + this.target.refInfo[name] = [id, `singleRefSetter(refs, \`${name}\`)`]; const index = block.data.push(id) - 1; attrs["block-ref"] = String(index); } @@ -5897,9 +5909,9 @@ See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration Object.defineProperty(exports, '__esModule', { value: true }); - __info__.version = '2.0.6'; - __info__.date = '2023-02-17T13:32:45.287Z'; - __info__.hash = '1291f1f'; + __info__.version = '2.0.7'; + __info__.date = '2023-02-20T08:44:56.632Z'; + __info__.hash = '276c8a0'; __info__.url = 'https://github.com/odoo/owl';