-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5: Mutating promise based arrays do not trigger updates #12166
Comments
This is because the |
Is this a limitation of proxies or is there some kind of technical limitation? And if so, shouldn't this be documented? |
This isn’t really technically possible without AsyncContext, which is just a TC39 proposal. You’re crossing the async boundary, so Svelte has no knowledge of the resolved value and its relationship to state. We already document that only a plain objects and arrays work with deep reactivity. |
If I'm not mistaken, this is the line you are referring to in the docs?
This doesn't state clearly that only POJOs and arrays are made deeply reactive. Also this should be documented in the breaking changes because it also breaks whether runes are used or not. |
Why is it a breaking change? Runes are only a 5.0 feature, they weren’t in 4. We can adjust the documentation to clarify. |
Because it breaks in non-runes mode. |
@navorite Ah that's likely something we can fix in non-runes mode then. :) |
Fixes sveltejs#12166. Turns out that the recent refactors here negated the fact that non-runes mode uses a slightly different source signal that has different equality rules. I also updated the docs in this PR too to reflect that only plain objects and arrays are proxied.
Fixes #12166. Turns out that the recent refactors here negated the fact that non-runes mode uses a slightly different source signal that has different equality rules. I also updated the docs in this PR too to reflect that only plain objects and arrays are proxied.
Describe the bug
If an awaited promise based array gets mutated, it doesn't trigger updates. To get to the correct state, one must hide the array then show the array items again. As far as I've debugged,
$inspect
doesn't detect the changes as well.Reproduction
Svelte 5 REPL
Expected: Svelte 4 REPL
Logs
No response
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: