Deep fine-grained reactivity : pushing element to an array triggers deep-down sibling reactivity #12616
Unanswered
plgingras88
asked this question in
Q&A
Replies: 3 comments 1 reply
-
App.svelte is not in runes mode, so I added |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
1 reply
-
Good to know ! Thanks for taking the time to reply, it's much appreciated! :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Greeting svelte folk ! I am a bit lost at none-primitive reactivity (array) and its scope.
In the repl below, I have a global $state([]) to which I add a new entry (project) each time I click the button. But anytime I click the add, which pushes an new entry to the list, each component will trigger an update output the console ( there is a $inspect({ name: project.name }) into that component).
Since I modified the array with a push, but not its previous entries by reference, I was not expecting all these update $inspect to the console. If you click 3 times, the last output will trigger 3 inspect : one init and 2 updates. Does this mean this could trigger re-render or impact performance ?
That being said, I am wondering if there's a place where such behaviors are clearly explained and what are the best patterns (simplicity and performance wise) to embrace the framework. The only doc/examples I could found were quite trivial and wouldn't dig much deeper so as I developer I can understand the magic happening behind runes, but also their caveats and limitations.
Thanks !
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACo1SwYrbMBD9lUHNwabGpldvEljYSy7LQg89xKGrWpNYWVsS0njbIPTvRbacpGwpvUmaNzPvPT3PjrJHx-q9Z4oPyGr2aAwrGF1MvLh37AlZwZwebRtf1q610tC2UQ3JwWhL4OEraYsQ4Gj1AA0rq-mhnLvLs2vYwx3-xeoztnRDp4eEn8Dr6rZHrX-MRFqBVm0v27eNz3LYbOetJRci9Wd52D4KAWa-rqu5bRrhPyFvu9SSAA64W8CQpUO5e8pDJLteaKbCxqdDgGrbKF_FgYEVbNBCHiUKVpMdMRRXJ-9NuFl6dvd2tj13Dr7PBvq490puAytHnDDbH_Jon2roXuuMbqjVyukey16fMuqkm7DUUDxflZZmdF3mYfdUw5-FHtWJus9fCoisa3hdZK_834HhtQDDT-hq2B8g5HFbaFT0TOGv6YMjJUqh2IDCn0lglj_8y6-0-X_TN0uP8Vv-METPjNXGZYtjUFXwrbtMouEN0TjQI5mRpDrBUVuYYrEM4OpCckDYARcC-ER9qZEG6hB66SJOgNDo5rFyMDzmBO1R24GrFkHPy1dSORN_68rxeTJ5yVoUDiH_kHch3yeJ_h4YIipWPnp4CL8BdybeSMkDAAA=
Beta Was this translation helpful? Give feedback.
All reactions