pull/15045/head
Rich Harris 9 months ago
parent 0c914eb185
commit 1988ba4345

@ -253,11 +253,12 @@ export function build_component(node, component_name, context, anchor = context.
}
}
} else if (attribute.type === 'AttachTag') {
// TODO do we need to create a derived here?
push_prop(
b.prop(
'init',
'get',
b.call('Symbol', b.literal('@attach')),
b.thunk(/** @type {Expression} */ (context.visit(attribute.expression))),
/** @type {Expression} */ (context.visit(attribute.expression)),
true
)
);

@ -409,7 +409,7 @@ export function set_attributes(
}
for (let symbol of Object.getOwnPropertySymbols(next)) {
attach(element, next[symbol]);
attach(element, () => next[symbol]);
}
return current;

@ -0,0 +1,8 @@
import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
test({ assert, logs, target }) {
assert.deepEqual(logs, ['hello']);
}
});

@ -0,0 +1,7 @@
<script>
let stuff = $state({
[Symbol()]: () => console.log('hello')
});
</script>
<div {...stuff}></div>
Loading…
Cancel
Save