mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: t-key and t-ref together
Have a t-ref on a DOM node with a t-key. Change the t-key. Before this commit, the old block removed its element from the component's refs *after* the new block had been mounted, meaning that in effect, the resulting ref at the end of the whole patch was null. After this commit, we only remove an element from the component's ref if that very same element was indeed the ref. (otherwise it means someone else has changed the ref.)
This commit is contained in:
committed by
Géry Debongnie
parent
1291f1f175
commit
0717fe241d
@@ -158,7 +158,7 @@ exports[`slots can render node with t-ref and Component in same slot 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
let { singleRefSetter, markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
||||
|
||||
@@ -166,7 +166,7 @@ exports[`slots can render node with t-ref and Component in same slot 1`] = `
|
||||
|
||||
function slot1(ctx, node, key = \\"\\") {
|
||||
const refs = this.__owl__.refs;
|
||||
const ref1 = (el) => refs[\`div\`] = el;
|
||||
const ref1 = singleRefSetter(refs, \`div\`);
|
||||
const b2 = block2([ref1]);
|
||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||
return multi([b2, b3]);
|
||||
|
||||
Reference in New Issue
Block a user