mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: do not look up ComponentNode in the context
With the introduction of t-call-context, there is now no guarantee that the ComponentNode can be found in the rendering context, any attempt to do so can crash when combined with t-call-context. This commit fixes that by using `this` instead, which in compiled templates refers to the component that is being rendered.
This commit is contained in:
committed by
Géry Debongnie
parent
3d49daedcd
commit
9a5edb4590
@@ -9,7 +9,7 @@ exports[`hooks autofocus hook input in a t-if 1`] = `
|
||||
let block2 = createBlock(\`<input block-ref=\\"0\\"/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const refs = ctx.__owl__.refs;
|
||||
const refs = this.__owl__.refs;
|
||||
const ref1 = (el) => refs[\`input1\`] = el;
|
||||
const ref2 = (el) => refs[\`input2\`] = el;
|
||||
let b2;
|
||||
@@ -29,7 +29,7 @@ exports[`hooks autofocus hook simple input 1`] = `
|
||||
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><input block-ref=\\"1\\"/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const refs = ctx.__owl__.refs;
|
||||
const refs = this.__owl__.refs;
|
||||
const ref1 = (el) => refs[\`input1\`] = el;
|
||||
const ref2 = (el) => refs[\`input2\`] = el;
|
||||
return block1([ref1, ref2]);
|
||||
@@ -268,7 +268,7 @@ exports[`hooks useEffect hook effect can depend on stuff in dom 1`] = `
|
||||
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const refs = ctx.__owl__.refs;
|
||||
const refs = this.__owl__.refs;
|
||||
const ref1 = (el) => refs[\`div\`] = el;
|
||||
let b2;
|
||||
if (ctx['state'].value) {
|
||||
@@ -357,7 +357,7 @@ exports[`hooks useRef hook: basic use 1`] = `
|
||||
let block1 = createBlock(\`<div><button block-ref=\\"0\\"><block-text-1/></button></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const refs = ctx.__owl__.refs;
|
||||
const refs = this.__owl__.refs;
|
||||
const ref1 = (el) => refs[\`button\`] = el;
|
||||
let txt1 = ctx['value'];
|
||||
return block1([ref1, txt1]);
|
||||
|
||||
Reference in New Issue
Block a user