[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
@@ -9,7 +9,7 @@ exports[`t-component can switch between dynamic components without the need for
return function template(ctx, node, key = \\"\\") {
let Comp1 = ctx['constructor'].components[ctx['state'].child];
let b2 = toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx));
let b2 = toggler(Comp1, component(Comp1, {}, key+\`__1\`,null, node, ctx));
return block1([], [b2]);
}
}"
@@ -49,7 +49,7 @@ exports[`t-component can use dynamic components (the class) if given (with diffe
return function template(ctx, node, key = \\"\\") {
const tKey_1 = ctx['state'].child;
let Comp1 = ctx['myComponent'];
return toggler(tKey_1, toggler(Comp1, component(Comp1, {}, tKey_1 + key + \`__1\`, node, ctx)));
return toggler(tKey_1, toggler(Comp1, component(Comp1, {}, key+\`__1\`,tKey_1, node, ctx)));
}
}"
`;
@@ -88,7 +88,7 @@ exports[`t-component can use dynamic components (the class) if given 1`] = `
return function template(ctx, node, key = \\"\\") {
const tKey_1 = ctx['state'].child;
let Comp1 = ctx['myComponent'];
return toggler(tKey_1, toggler(Comp1, component(Comp1, {}, tKey_1 + key + \`__1\`, node, ctx)));
return toggler(tKey_1, toggler(Comp1, component(Comp1, {}, key+\`__1\`,tKey_1, node, ctx)));
}
}"
`;
@@ -128,7 +128,7 @@ exports[`t-component modifying a sub widget 1`] = `
return function template(ctx, node, key = \\"\\") {
let Comp1 = ctx['Counter'];
let b2 = toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx));
let b2 = toggler(Comp1, component(Comp1, {}, key+\`__1\`,null, node, ctx));
return block1([], [b2]);
}
}"
@@ -157,7 +157,7 @@ exports[`t-component switching dynamic component 1`] = `
return function template(ctx, node, key = \\"\\") {
let Comp1 = ctx['Child'];
return toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx));
return toggler(Comp1, component(Comp1, {}, key+\`__1\`,null, node, ctx));
}
}"
`;
@@ -193,7 +193,7 @@ exports[`t-component t-component works in simple case 1`] = `
return function template(ctx, node, key = \\"\\") {
let Comp1 = ctx['Child'];
return toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx));
return toggler(Comp1, component(Comp1, {}, key+\`__1\`,null, node, ctx));
}
}"
`;