mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] properly get component reference instead of context
Before this commit, the generated code for the component directive was using the current context as the place to look for static informations (such as the sub components). However, it is not entirely correct, since the current context may be different than the current component (which is easily accessed by using the this variable). Also, while doing this, we fix some issues in the t-set directive, which as calling lazy values with the wrong this.
This commit is contained in:
@@ -16,7 +16,7 @@ exports[`t-key t-foreach with t-key switch component position 1`] = `
|
||||
ctx[\`c\`] = v_block2[i1];
|
||||
const key1 = ctx['c'];
|
||||
const tKey_1 = ctx['key1'];
|
||||
c_block2[i1] = withKey(comp1({key: ctx['c']+ctx['key1']}, tKey_1 + key + \`__1__\${key1}\`, node, ctx, null), tKey_1 + key1);
|
||||
c_block2[i1] = withKey(comp1({key: ctx['c']+ctx['key1']}, tKey_1 + key + \`__1__\${key1}\`, node, this, null), tKey_1 + key1);
|
||||
}
|
||||
const b2 = list(c_block2);
|
||||
return block1([], [b2]);
|
||||
@@ -46,7 +46,7 @@ exports[`t-key t-key on Component 1`] = `
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const tKey_1 = ctx['key'];
|
||||
return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, null));
|
||||
return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null));
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -75,7 +75,7 @@ exports[`t-key t-key on Component as a function 1`] = `
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const tKey_1 = ctx['key'];
|
||||
const b2 = toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, null));
|
||||
const b2 = toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null));
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -106,9 +106,9 @@ exports[`t-key t-key on multiple Components 1`] = `
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const tKey_1 = ctx['key1'];
|
||||
const b2 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx, null));
|
||||
const b2 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, this, null));
|
||||
const tKey_2 = ctx['key2'];
|
||||
const b3 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, ctx, null));
|
||||
const b3 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, this, null));
|
||||
return block1([], [b2, b3]);
|
||||
}
|
||||
}"
|
||||
@@ -163,7 +163,7 @@ exports[`t-key t-key on multiple Components with t-call 1 2`] = `
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const tKey_1 = ctx['key'];
|
||||
return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, null));
|
||||
return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null));
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -206,9 +206,9 @@ exports[`t-key t-key on multiple Components with t-call 2 2`] = `
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const tKey_1 = ctx['key1'];
|
||||
const b2 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx, null));
|
||||
const b2 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, this, null));
|
||||
const tKey_2 = ctx['key2'];
|
||||
const b3 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, ctx, null));
|
||||
const b3 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, this, null));
|
||||
return multi([b2, b3]);
|
||||
}
|
||||
}"
|
||||
|
||||
Reference in New Issue
Block a user