Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure if_block dependency is dirty to cancel outro #4634

Merged
merged 14 commits into from
Apr 23, 2020
19 changes: 5 additions & 14 deletions src/compiler/compile/render_dom/wrappers/IfBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,26 +520,17 @@ export default class IfBlockWrapper extends Wrapper {
if (branch.dependencies.length > 0) {
const update_mount_node = this.get_update_mount_node(anchor);

const enter = dynamic
? b`
if (${name}) {
${name}.p(#ctx, #dirty);
${has_transitions && b`@transition_in(${name}, 1);`}
} else {
${name} = ${branch.block.name}(#ctx);
${name}.c();
${has_transitions && b`@transition_in(${name}, 1);`}
${name}.m(${update_mount_node}, ${anchor});
}
`
: b`
const enter = b`
if (!${name}) {
${name} = ${branch.block.name}(#ctx);
${name}.c();
${has_transitions && b`@transition_in(${name}, 1);`}
${name}.m(${update_mount_node}, ${anchor});
} else {
${has_transitions && b`@transition_in(${name}, 1);`}
${dynamic && b`${name}.p(#ctx, #dirty);`}
if (${block.renderer.dirty(branch.dependencies)}) {
${has_transitions && b`@transition_in(${name}, 1);`}
}
}
`;

Expand Down