diff --git a/addons/web/static/src/legacy/js/owl_compatibility.js b/addons/web/static/src/legacy/js/owl_compatibility.js index 2dbc895aa32..cd9eb32836e 100644 --- a/addons/web/static/src/legacy/js/owl_compatibility.js +++ b/addons/web/static/src/legacy/js/owl_compatibility.js @@ -626,6 +626,9 @@ odoo.define('web.OwlCompatibility', function (require) { } render() { + if (this.status !== "mounted") { + return; + } if (this.renderProm) { this.node.render(true); return this.renderProm; diff --git a/addons/web/static/tests/legacy/owl_compatibility_tests.js b/addons/web/static/tests/legacy/owl_compatibility_tests.js index 89df699aea6..8296fd01041 100644 --- a/addons/web/static/tests/legacy/owl_compatibility_tests.js +++ b/addons/web/static/tests/legacy/owl_compatibility_tests.js @@ -1060,7 +1060,7 @@ odoo.define('web.OwlCompatibilityTests', function (require) { }); QUnit.test("lifecycle mount in fragment", async function (assert) { - assert.expect(17); + assert.expect(18); class MyChildComponent extends LegacyComponent { setup() { @@ -1077,8 +1077,8 @@ odoo.define('web.OwlCompatibilityTests', function (require) { MyComponent.components = { MyChildComponent }; const MyWidget = WidgetAdapter.extend({ start() { - let component = new ComponentWrapper(this, MyComponent, {}); - return component.mount(this.el); + this.component = new ComponentWrapper(this, MyComponent, {}); + return this.component.mount(this.el); } }); @@ -1097,6 +1097,9 @@ odoo.define('web.OwlCompatibilityTests', function (require) { "onRendered MyChildComponent", ]); + await widget.component.update({}); + assert.verifySteps([]); // Out of DOM: shouldn't do anything. + widget.$el.appendTo(target); widget.on_attach_callback(); assert.verifySteps([