Skip to content

Commit 6402161

Browse files
committed
actually let's do this instead
1 parent 1664fd8 commit 6402161

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { effect } from '../../reactivity/effects.js';
66
*/
77
export function attach(node, get_fn) {
88
effect(() => {
9-
return (get_fn())?.(node);
9+
const fn = get_fn();
10+
11+
// we use `&&` rather than `?.` so that things like
12+
// `{@attach DEV && something_dev_only()}` work
13+
return fn && fn(node);
1014
});
1115
}

0 commit comments

Comments
 (0)