From 6a30ab13536a2dc0a8f23df32962cd1ceec71a5d Mon Sep 17 00:00:00 2001 From: "Michael (mcm)" Date: Thu, 9 Nov 2023 11:55:51 +0100 Subject: [PATCH] [FIX] web: mount on detached element Before this commit, a component couldn't be mounted on a public widget that wasn't yet attached in the dom. closes odoo/odoo#141665 Signed-off-by: Samuel Degueldre (sad) --- addons/web/static/src/legacy/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/legacy/utils.js b/addons/web/static/src/legacy/utils.js index 59a4a546b5e..d8171132cda 100644 --- a/addons/web/static/src/legacy/utils.js +++ b/addons/web/static/src/legacy/utils.js @@ -32,7 +32,11 @@ export async function attachComponent(parent, element, componentClass, props = { }); } - const component = await app.mount(element); + const originalValidateTarget = App.validateTarget; + App.validateTarget = () => {}; + const mountPromise = app.mount(element); + App.validateTarget = originalValidateTarget; + const component = await mountPromise; const subComp = Object.values(component.__owl__.children)[0].component; return { component: subComp,