Skip to content

Commit 50b905a

Browse files
authored
fix: skip unnecessary $$legacy flag (#12850)
1 parent 57a4b5d commit 50b905a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.changeset/tricky-coats-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: skip unnecessary `$$legacy` flag

packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/component.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ export function build_component(node, component_name, context, anchor = context.
298298
push_prop(b.init('$$slots', b.object(serialized_slots)));
299299
}
300300

301-
if (!context.state.analysis.runes) {
301+
if (
302+
!context.state.analysis.runes &&
303+
node.attributes.some((attribute) => attribute.type === 'BindDirective')
304+
) {
302305
push_prop(b.init('$$legacy', b.true));
303306
}
304307

packages/svelte/tests/snapshot/samples/purity/_expected/client/index.svelte.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ export default function Purity($$anchor) {
2323

2424
var node = $.sibling($.sibling(p_1, true));
2525

26-
Child(node, {
27-
prop: encodeURIComponent(value),
28-
$$legacy: true
29-
});
30-
26+
Child(node, { prop: encodeURIComponent(value) });
3127
$.append($$anchor, fragment);
3228
}

0 commit comments

Comments
 (0)