-
-
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
Reactivity problem with objects/arrays in some case (toString) #13054
Comments
We actually made this change intentionally to move away from this. It turns out that if you have a large collection of data, and you change some state then going through each row and calling So the recommended pattern for this is to actually do |
Yeah this has come in several variants now, TLDR we won't change this. But yes, maybe document this somewhere, though not sure where/how without confusing people. |
In fact I had simply used a simple This is very confusing because it will work if we add text in the node : |
Describe the bug
If you only use one object in a node's template, the node's text/html is not updated correctly when the object's content changes
Ex:
The problem seems to be that set_text() from render.js compares the object reference (which does not change) :
One solution might be to convert the value into string before comparing it :
Same problem for html() from html.js :
Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACqVVTW-CQBD9KxPSGI1G7BWQtIcmPbSn2qSJ9ADrqtviLtkdTAzhvxd2pWCrFuiFMF_vzTxeQmatWUyV5Swzi4c7ajnWfZJYEwsPSRmoPY2RFrESqSRlxlNEsgT9gAcYU4RQyvAAc7hRGCIdLmfvI7eqieiDEqyLWVkIkIiUozObmAjFC0rGN8MRHOsBSoqp5IBbpqa62xTyfKRfePlcp5wgExwYJ5LuKMcaQS9VrALjOdy6JmeWMXDjsU7mAffs-h7uRWmxDgfBSczI5zz7hs71vTqrAEXNCR4RK-pXhJ6tQwj56lhp0h6rJathMqyJ_6oKAWDx8LZwvEjaZYfuHMToRoMNuoM4kiGhbsUzkCYuG2zdUTEzBZKGhTJ7Cg54kZ9VM3nB6reAv4rNBZ7Fb4IHeA1-Wn_wXkyN-RYXNeXvIlpzrjVN13vMVCvpjvu01O78MReEs5NTGz4unp_-sOHdFncx9DHj6WQLZRsDXeVtjHYj-odFz6O0pu9r19_THSn73dnBwCcb9rPxBYifZi7-VjuxYmtGV5aDMqX5e_4F-oUWDOgGAAA=
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: