summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2021-04-02 15:50:20 +0000
committerSébastien Theys <seb@odoo.com>2021-04-02 16:23:17 +0000
commit8782de993d922b321d3be479dbb84e9d20a0c87a (patch)
treea437ac8298c7ff66ae0c80278e638b82facb7ebd /addons/web
parentd6c1d1572eafc2586974f2c5b98abe2b341b38a7 (diff)
[FIX] web: ignore recursiveCallMounted on not yet rendered children
This should hopefully fix the race condition that is described in the related task. The issue is that our mounted callbacks are legitimately relying on the component to be actually rendered. task-2481713 closes odoo/odoo#68711 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/owl_compatibility.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/addons/web/static/src/js/owl_compatibility.js b/addons/web/static/src/js/owl_compatibility.js
index b20ad7890f0..aabb0f9861c 100644
--- a/addons/web/static/src/js/owl_compatibility.js
+++ b/addons/web/static/src/js/owl_compatibility.js
@@ -375,6 +375,17 @@ odoo.define('web.OwlCompatibility', function () {
*/
on_attach_callback() {
function recursiveCallMounted(component) {
+ if (
+ component.__owl__.status !== 2 /* RENDERED */ &&
+ component.__owl__.status !== 3 /* MOUNTED */ &&
+ component.__owl__.status !== 4 /* UNMOUNTED */
+ ) {
+ // Avoid calling mounted on a component that is not even
+ // rendered. Doing otherwise will lead to a crash if a
+ // specific mounted callback is legitimately relying on the
+ // component being mounted.
+ return;
+ }
for (const key in component.__owl__.children) {
recursiveCallMounted(component.__owl__.children[key]);
}