Skip to content

Commit 4ce5f37

Browse files
committed
fix: correctly compile $effect.root in svelte modules
1 parent b2448dc commit 4ce5f37

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.changeset/smart-fans-crash.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: correctly compile $effect.root in svelte modules

packages/svelte/src/compiler/phases/3-transform/server/transform-server.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,13 @@ const global_visitors = {
411411
return b.literal(false);
412412
}
413413

414+
if (rune === '$effect.root') {
415+
const args = /** @type {import('estree').Expression[]} */ (
416+
node.arguments.map((arg) => context.visit(arg))
417+
);
418+
return b.call('$.effect_root', ...args);
419+
}
420+
414421
if (rune === '$state.snapshot') {
415422
return /** @type {import('estree').Expression} */ (context.visit(node.arguments[0]));
416423
}

0 commit comments

Comments
 (0)