-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Reassigning an object to a writable store using $-prefix causes its value to become a proxy in runes mode #15281
Comments
Is it possible for store to return proxy always? From us, user sight, store looks to return original object or proxy unpredictably. If it was proxy always, we could avoid "lucky shot" and deal with improper usage from the beginning. How about doing so in dev mode at least? |
I also tested the behavior in Svelte 4 and observed that when changing a store’s value, it was not proxified. Below are the demo code and a table of the results:
Considering backwards compatibility with Svelte 4, I believe that having the store’s value proxified when reassigning to the store with $-prefix is unintentional. A store’s value should consistently not be proxified. |
This sounds good to me. It'd be great if the result was either always original or always proxy Anyway I'm going to replace |
Describe the bug
related #15280
When writing a Svelte component like the following in runes mode...
{ name: 'bar' }
becomes proxied in the JS output as shown below:In the following cases, this issue does not occur:
set
method instead of the=
operatorReproduction
https://svelte.dev/playground/77f58c2f61394b4ca4efc5b62ea63d29?version=5.20.0
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: