You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting either an ownership_invalid_mutation or ownership_invalid_binding warning from the compiler when I try to modify array elements of shared state passed through a context.
The warnings aren't given when modifying base properties of the context, only for elements of arrays.
The first happens if I try to do something like the following and bind to the element directly
{#eacharrayaselem}
<Childbind:elem />
{/each}
And the second if I try to pass the index and modify the element
{#eacharrayas_elem, idx}
<Child {idx} />
{/each}
What would be the correct way to modify elements of an array using shared state?
Describe the bug
I'm getting either an ownership_invalid_mutation or ownership_invalid_binding warning from the compiler when I try to modify array elements of shared state passed through a context.
The warnings aren't given when modifying base properties of the context, only for elements of arrays.
The first happens if I try to do something like the following and bind to the element directly
And the second if I try to pass the index and modify the element
What would be the correct way to modify elements of an array using shared state?
Reproduction
https://stackblitz.com/edit/stackblitz-starters-kks8ef?file=src%2Froutes%2F%2Bpage.svelte
This is a minimal reproduction of both techniques using svelte@5.0.0-next.148
Logs
No response
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: svelte: ^5.0.0-next.1 => 5.0.0-next.148
Severity
annoyance
The text was updated successfully, but these errors were encountered: