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 runes
Severity
blocking an upgrade
Metadata
Metadata
Assignees
Labels
No labels