Skip to content

Commit 35b9d21

Browse files
committed
fix
1 parent 1d4cb8e commit 35b9d21

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

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

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,18 @@ import * as b from '../../../../utils/builders.js';
99
*/
1010
export function Attachment(node, context) {
1111
for (const attachment of node.attachments) {
12-
if (attachment.type === 'SpreadElement') {
13-
context.state.init.push(
14-
b.stmt(
15-
b.call(
16-
'$.attach_all',
17-
context.state.node,
18-
b.thunk(/** @type {Expression} */ (context.visit(attachment.argument)))
12+
context.state.init.push(
13+
b.stmt(
14+
b.call(
15+
'$.attach',
16+
context.state.node,
17+
b.thunk(
18+
/** @type {Expression} */ (
19+
context.visit(attachment.type === 'SpreadElement' ? attachment.argument : attachment)
20+
)
1921
)
2022
)
21-
);
22-
} else {
23-
context.state.init.push(
24-
b.stmt(
25-
b.call(
26-
'$.attach',
27-
context.state.node,
28-
b.thunk(/** @type {Expression} */ (context.visit(attachment)))
29-
)
30-
)
31-
);
32-
}
23+
)
24+
);
3325
}
3426
}

packages/svelte/src/internal/client/dom/elements/attachments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function attach(node, get_fn) {
1111
if (Array.isArray(attachment)) {
1212
for (const fn of attachment) {
1313
if (fn) {
14-
$effect(() => fn(node));
14+
effect(() => fn(node));
1515
}
1616
}
1717
} else if (attachment) {

0 commit comments

Comments
 (0)