You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 (like this="div" instead of this={"div"})
or, when the svelte:element doesn't have any other svelte components as children.
The bug affects all svelte versions that support svelte:element including v3.47.0 (except svelte 5 preview).
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) {
ranjan-purbey
changed the title
Svelte component nested inside a <svelte:element> with dynamic this breaks attribute reactivity
Svelte component nested inside a <svelte:element> with dynamic 'this' breaks attribute reactivity
Dec 2, 2023
Describe the bug
Nesting a svelte component inside a svelte:element 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 the
svelte: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
The text was updated successfully, but these errors were encountered: