diff --git a/src/compiler/compile/nodes/shared/Expression.ts b/src/compiler/compile/nodes/shared/Expression.ts index ee04f83b77..29130ca849 100644 --- a/src/compiler/compile/nodes/shared/Expression.ts +++ b/src/compiler/compile/nodes/shared/Expression.ts @@ -138,7 +138,8 @@ export default class Expression { } if (template_scope.is_let(name)) { - if (!function_expression) { + if (!function_expression) { // TODO should this be `!lazy` ? + contextual_dependencies.add(name); dependencies.add(name); } } else if (template_scope.names.has(name)) { diff --git a/test/runtime/samples/component-slot-let-in-binding/Nested.svelte b/test/runtime/samples/component-slot-let-in-binding/Nested.svelte new file mode 100644 index 0000000000..96f7adcfc6 --- /dev/null +++ b/test/runtime/samples/component-slot-let-in-binding/Nested.svelte @@ -0,0 +1,9 @@ + + +
+ {#each items as item, index} + + {/each} +
\ No newline at end of file diff --git a/test/runtime/samples/component-slot-let-in-binding/_config.js b/test/runtime/samples/component-slot-let-in-binding/_config.js new file mode 100644 index 0000000000..41e77a9574 --- /dev/null +++ b/test/runtime/samples/component-slot-let-in-binding/_config.js @@ -0,0 +1,26 @@ +export default { + html: ` +
+ + + +
+ `, + + ssrHtml: ` +
+ + + +
+ `, + + async test({ assert, component, target, window }) { + const inputs = target.querySelectorAll('input'); + + inputs[2].value = 'd'; + await inputs[2].dispatchEvent(new window.Event('input')); + + assert.deepEqual(component.letters, ['a', 'b', 'd']); + } +}; diff --git a/test/runtime/samples/component-slot-let-in-binding/main.svelte b/test/runtime/samples/component-slot-let-in-binding/main.svelte new file mode 100644 index 0000000000..89531bf236 --- /dev/null +++ b/test/runtime/samples/component-slot-let-in-binding/main.svelte @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file