-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
In this component
<script>
let items = $state([]);
function registerItem(item) {
console.log(item);
}
export function action(node, items) {
return {
update: (items) => {
console.log('got update');
for (const item of items) {
registerItem(item);
}
},
destroy: () => {}
};
}
function addItem() {
items.push(items.length);
}
function addItemOldWay() {
items = [...items, items.length]
}
function removeItem() {
items.pop();
}
</script>
<button on:click={addItem}>add item</button>
<button on:click={addItemOldWay}>add item</button>
<button on:click={removeItem}>remove item</button>
{#each items as item}
<div>{item}</div>
{/each}
<div use:action={items}></div>
I only see logs when using the old way of assignment reactivity, since we can use push now I expected this to work in actions too, it seems like it doesn't
Reproduction
Logs
No response
System Info
repl with runesSeverity
blocking an upgrade
Metadata
Metadata
Assignees
Labels
No labels