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 experiencing the ownership_invalid_mutation warning, where is says "src/Child.svelte mutated a value owned by src/App.svelte. This is strongly discouraged. Consider passing values to child components with bind:, or use a callback instead".
The problem I noticed (after running the repro demo below) are
The obj variable is declared in Shared.svelte.ts, and mutated in App.svelte. Why the warning says it is owned by App.svelte instead of Shared.svelte.ts?
Why is this pattern bad? What is the harm here?
Even if it is bad, I can easily bypass the warning by changing
facade.obj = { a: 1 }
from App.svelte to
facade.obj.a = 1
which I think is exactly equivalent. Why is it suddenly OK now?
4. $state.snapshot() currently doesn't seem to help in any way.
Reproduction
I managed to create a minimum demo, but strangely I can only reproduce the warning running locally.
Steps:
I don't know a way to create Svelte 5 template, so npm create vite@latest my-svelte-project -- --template svelte.
Manually upgrade dependencies in package.json to Svelte 5.
This was fixed by #11812 which was supposed to be released already, but it seems the CI fucked up. Investigating that, but closing this issue in the meantime.
Describe the bug
I'm experiencing the
ownership_invalid_mutation
warning, where is says "src/Child.svelte mutated a value owned by src/App.svelte. This is strongly discouraged. Consider passing values to child components withbind:
, or use a callback instead".The problem I noticed (after running the repro demo below) are
obj
variable is declared in Shared.svelte.ts, and mutated in App.svelte. Why the warning says it is owned by App.svelte instead of Shared.svelte.ts?from App.svelte to
which I think is exactly equivalent. Why is it suddenly OK now?
4.
$state.snapshot()
currently doesn't seem to help in any way.Reproduction
I managed to create a minimum demo, but strangely I can only reproduce the warning running locally.
Steps:
npm create vite@latest my-svelte-project -- --template svelte
.npm run dev
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: