-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
is it bug? #14803
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
Comments
Not exactly, it was previously decided to not handle this. Objects that are not primitives should generally not be used like this. You are causing an implicit string conversion which the compiler will ignore for non-state variables. Instead of treating every value in the template as potentially dynamic, only property accesses and function calls will add an effect. Usually the implicit string conversion of objects is fairly useless anyway (e.g. with dates it outputs a very verbose representation and for arrays there are no spaces between elements). If you want this to happen and dynamically update anyway, you can explicitly convert the value: - <p>value #1: {newValue}</p>
+ <p>value #1: {newValue.toString()}</p> You can also make the variable be considered stateful, e.g.: - let { value: newValue } = value;
+ let { value: newValue } = $derived(value); Playground |
Thanks, I understood |
Describe the bug
https://svelte.dev/playground/8927c1b4ff6e4905a459fb4045fecdeb?version=5.15.0
why clicking on update value #1 don't update in template?
Reproduction
https://svelte.dev/playground/8927c1b4ff6e4905a459fb4045fecdeb?version=5.15.0
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: