fix child context in await blocks with no `then` variable (#4022)

pull/4062/head
Conduitry 5 years ago
parent 4e51d35dd8
commit 185ff4ae04

@ -206,7 +206,7 @@ export default class AwaitBlockWrapper extends Wrapper {
} else {
const #child_ctx = #ctx.slice();
#child_ctx[${value_index}] = ${info}.resolved;
${this.node.value && x`#child_ctx[${value_index}] = ${info}.resolved;`}
${info}.block.p(#child_ctx, #dirty);
}
`);
@ -220,7 +220,7 @@ export default class AwaitBlockWrapper extends Wrapper {
block.chunks.update.push(b`
{
const #child_ctx = #ctx.slice();
#child_ctx[${value_index}] = ${info}.resolved;
${this.node.value && x`#child_ctx[${value_index}] = ${info}.resolved;`}
${info}.block.p(#child_ctx, #dirty);
}
`);

@ -0,0 +1,12 @@
<script>
const promise = new Promise(() => {});
const test = [1, 2, 3];
</script>
{#await promise}
<div>waiting</div>
{:then}
{#each test as t}
<div>t</div>
{/each}
{/await}
Loading…
Cancel
Save