[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) <sad@odoo.com>
This commit is contained in:
Michael (mcm)
2023-11-09 13:38:43 +00:00
parent af2b0eb73f
commit 6a30ab1353
+5 -1
View File
@@ -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,