[FIX] component: render in delayed willUpdateProps

Have a child component on which a render is triggered.
This component delays its willUpdateProps and makes a rendering during the willUpdateProps

Before this commit, renderings of the child were inconsistent across
its parent's renderings.

After this commit, it works as expected.
This commit is contained in:
Lucas Perais (lpe)
2021-12-04 18:35:31 +01:00
committed by Aaron Bohy
parent 6f435c36d8
commit 894deed13b
4 changed files with 424 additions and 10 deletions
@@ -939,6 +939,82 @@ exports[`creating two async components, scenario 3 (patching in the same frame)
}"
`;
exports[`delay willUpdateProps 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
let b2 = text(ctx['props'].value);
let b3 = text(\`_\`);
let b4 = text(ctx['state'].int);
return multi([b2, b3, b4]);
}
}"
`;
exports[`delay willUpdateProps 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx);
}
}"
`;
exports[`delay willUpdateProps with rendering grandchild 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
let b2 = text(ctx['props'].value);
let b3 = text(\`_\`);
let b4 = text(ctx['state'].int);
return multi([b2, b3, b4]);
}
}"
`;
exports[`delay willUpdateProps with rendering grandchild 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<div/>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`delay willUpdateProps with rendering grandchild 3`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
let b2 = component(\`DelayedChild\`, {value: ctx['props'].state.value}, key + \`__1\`, node, ctx);
let b3 = component(\`ReactiveChild\`, {}, key + \`__2\`, node, ctx);
return multi([b2, b3]);
}
}"
`;
exports[`delay willUpdateProps with rendering grandchild 4`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return component(\`Parent\`, {state: ctx['state']}, key + \`__1\`, node, ctx);
}
}"
`;
exports[`destroying/recreating a subwidget with different props (if start is not over) 1`] = `
"function anonymous(bdom, helpers
) {
@@ -1099,6 +1175,28 @@ exports[`two renderings initiated between willPatch and patched 2`] = `
}"
`;
exports[`two sequential renderings before an animation frame 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return text(ctx['props'].value);
}
}"
`;
exports[`two sequential renderings before an animation frame 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx);
}
}"
`;
exports[`update a sub-component twice in the same frame 1`] = `
"function anonymous(bdom, helpers
) {