diff --git a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts index 13c96d0065ae..631c172576d9 100644 --- a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts @@ -182,11 +182,9 @@ export default class InlineComponentWrapper extends Wrapper { }); }); - const non_let_dependencies = Array.from(fragment_dependencies).filter(name => !this.node.scope.is_let(name)); - const dynamic_attributes = this.node.attributes.filter(a => a.get_dependencies().length > 0); - if (!uses_spread && (dynamic_attributes.length > 0 || this.node.bindings.length > 0 || non_let_dependencies.length > 0)) { + if (!uses_spread && (dynamic_attributes.length > 0 || this.node.bindings.length > 0 || fragment_dependencies.size > 0)) { updates.push(b`const ${name_changes} = {};`); } @@ -266,9 +264,9 @@ export default class InlineComponentWrapper extends Wrapper { } } - if (non_let_dependencies.length > 0) { + if (fragment_dependencies.size > 0) { updates.push(b` - if (${renderer.dirty(non_let_dependencies)}) { + if (${renderer.dirty(Array.from(fragment_dependencies))}) { ${name_changes}.$$scope = { dirty: #dirty, ctx: #ctx }; }`); } diff --git a/test/runtime/samples/component-slot-let-in-slot/Inner.svelte b/test/runtime/samples/component-slot-let-in-slot/Inner.svelte new file mode 100644 index 000000000000..d0ea817d547f --- /dev/null +++ b/test/runtime/samples/component-slot-let-in-slot/Inner.svelte @@ -0,0 +1 @@ + diff --git a/test/runtime/samples/component-slot-let-in-slot/Outer.svelte b/test/runtime/samples/component-slot-let-in-slot/Outer.svelte new file mode 100644 index 000000000000..590a70564a8f --- /dev/null +++ b/test/runtime/samples/component-slot-let-in-slot/Outer.svelte @@ -0,0 +1,5 @@ + + + diff --git a/test/runtime/samples/component-slot-let-in-slot/_config.js b/test/runtime/samples/component-slot-let-in-slot/_config.js new file mode 100644 index 000000000000..a86d869581fa --- /dev/null +++ b/test/runtime/samples/component-slot-let-in-slot/_config.js @@ -0,0 +1,12 @@ +export default { + props: { + prop: 'a', + }, + + html: 'a', + + test({ assert, component, target }) { + component.prop = 'b'; + assert.htmlEqual( target.innerHTML, 'b' ); + } +}; diff --git a/test/runtime/samples/component-slot-let-in-slot/main.svelte b/test/runtime/samples/component-slot-let-in-slot/main.svelte new file mode 100644 index 000000000000..7ebb4ebc21c5 --- /dev/null +++ b/test/runtime/samples/component-slot-let-in-slot/main.svelte @@ -0,0 +1,10 @@ + + + + {value} +