Open ranjan-purbey opened 10 months ago
Idk if this change makes sense, but it seems to solve the issue as well as passes all existing tests
diff --git a/packages/svelte/src/compiler/compile/render_dom/Block.js b/packages/svelte/src/compiler/compile/render_dom/Block.js
index 7f0f37aa7..ed076ea42 100644
--- a/packages/svelte/src/compiler/compile/render_dom/Block.js
+++ b/packages/svelte/src/compiler/compile/render_dom/Block.js
@@ -265,6 +265,8 @@ export default class Block {
this.add_variable({ type: 'Identifier', name: '#current' });
if (this.chunks.intro.length > 0) {
this.chunks.intro.push(b`#current = true;`);
+ }
+ if (this.chunks.mount.length > 0) {
this.chunks.mount.push(b`#current = true;`);
}
if (this.chunks.outro.length > 0) {
Ran into this issue as well, using svelte@4.2.9
Describe the bug
Nesting a svelte component inside a with dynamic this like this:
breaks attribute reactivity for the entire svelte block. Though content reactivity is not affected.
This issue doesn't pop up when either the
this
attr is static (likethis="div"
instead ofthis={"div"}
) or, when thesvelte:element
doesn't have any other svelte components as children.The bug affects all svelte versions that support
svelte:element
includingv3.47.0
(except svelte 5 preview).Reproduction
div
change.<MyComponent/>
inside<svelte:element>
)this
attribute ofsvelte:element
static by removing the curly braces.Logs
No response
System Info
Severity
blocking all usage of svelte