diff --git a/src/compiler/compile/render_dom/wrappers/Slot.ts b/src/compiler/compile/render_dom/wrappers/Slot.ts index 37b10c2ea3..f287198132 100644 --- a/src/compiler/compile/render_dom/wrappers/Slot.ts +++ b/src/compiler/compile/render_dom/wrappers/Slot.ts @@ -38,6 +38,7 @@ export default class SlotWrapper extends Wrapper { name: this.renderer.component.get_unique_name(`fallback_block`), type: 'fallback' }); + renderer.blocks.push(this.fallback); } this.fragment = new FragmentWrapper( @@ -115,7 +116,6 @@ export default class SlotWrapper extends Wrapper { if (this.fallback) { this.fragment.render(this.fallback, null, x`#nodes` as Identifier); - renderer.blocks.push(this.fallback); } const slot = block.get_unique_name(`${sanitize(slot_name)}_slot`); diff --git a/test/runtime/samples/component-slot-fallback-3/Inner.svelte b/test/runtime/samples/component-slot-fallback-3/Inner.svelte new file mode 100644 index 0000000000..db2af272d2 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-3/Inner.svelte @@ -0,0 +1,6 @@ + +
Hello
+
world
+
Bye
+
World
+
diff --git a/test/runtime/samples/component-slot-fallback-3/_config.js b/test/runtime/samples/component-slot-fallback-3/_config.js new file mode 100644 index 0000000000..b5591fb5e0 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-3/_config.js @@ -0,0 +1,6 @@ +export default { + html: ` +
Hello World
+
Hello
world
Bye
World
+ `, +}; diff --git a/test/runtime/samples/component-slot-fallback-3/main.svelte b/test/runtime/samples/component-slot-fallback-3/main.svelte new file mode 100644 index 0000000000..eda7ea60e4 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-3/main.svelte @@ -0,0 +1,9 @@ + + + +
Hello World
+
+ +