[FIX] compiler, component: handle change of t-key before patch

Have a dynamic children with a t-key. This child has a delayed willStart.
Change the key during a rendering.

Before this commit there was a leak: a component corresponding to an old key had been created, xwithout being destroyed.

After this commit, the outdated component is destroyed.
This commit is contained in:
Lucas Perais (lpe)
2022-01-10 19:32:49 +01:00
parent a568ca6687
commit b9f5a9aa47
27 changed files with 547 additions and 445 deletions
@@ -43,7 +43,7 @@ exports[`hooks can use onWillStart, onWillUpdateProps 1`] = `
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return component(\`MyComponent\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx);
return component(\`MyComponent\`, {value: ctx['state'].value}, key+\`__1\`,null, node, ctx);
}
}"
`;
@@ -110,7 +110,7 @@ exports[`hooks parent and child env 1`] = `
return function template(ctx, node, key = \\"\\") {
let b2 = text(ctx['env'].val);
let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
let b3 = component(\`Child\`, {}, key+\`__1\`,null, node, ctx);
return multi([b2, b3]);
}
}"
@@ -164,7 +164,7 @@ exports[`hooks use sub env supports arbitrary descriptor 1`] = `
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return component(\`Child\`, {}, key + \`__1\`, node, ctx);
return component(\`Child\`, {}, key+\`__1\`,null, node, ctx);
}
}"
`;
@@ -251,7 +251,7 @@ exports[`hooks useExternalListener 1`] = `
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].flag) {
b2 = component(\`MyComponent\`, {}, key + \`__1\`, node, ctx);
b2 = component(\`MyComponent\`, {}, key+\`__1\`,null, node, ctx);
}
return multi([b2]);
}