mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: fix t-call at root of template causing crashes
Because the default content of a t-call is compiled before the block of the t-call is created, the default content can sometimes incorrectly be treated as though it is at the root of the template. This causes various issues, in the case of a t-if, the default content will just replace the t-call entirely when truthy, and when falsy the template will not return anything, leading to a crash. Similar things occur with t-foreach and t-out with a default content. This commit fixes that by moving the block creation for the t-call ahead of the compilation of the default content. In doing so, it makes the context attribute "preventRoot" obsolete: the purpose of this attribute is to somehow make the code aware that the root of the template will be defined later, but because it wasn't propagated everywhere properly it caused this issue. Now that the root already exists before we compile the default content, we don't need it anymore.
This commit is contained in:
committed by
Lucas Perais - lpe@odoo
parent
28672096a2
commit
ba34811f71
@@ -10,8 +10,8 @@ exports[`t-call dynamic t-call 1`] = `
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
const b1 = text(\` owl \`);
|
||||
ctx[zero] = b1;
|
||||
const b2 = text(\` owl \`);
|
||||
ctx[zero] = b2;
|
||||
const template1 = (ctx['current'].template);
|
||||
return call(this, template1, ctx, node, key + \`__1\`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user