Skip to content

UI not re-rendering when rune is updatedΒ #9301

@peterreeves

Description

@peterreeves

Describe the bug

So I'm not 100% sure if this is a bug with runes, but it sure feels like one.

In the example below I have a $state rune in a Svelte component, and a $state rune in a JS file. Both are arrays, and I'm pushing values into the array and doing the old list = list trick to trigger an update. This works in the component, but not in the one imported from the JS file. The problem goes away if I uses a spread operator (list = [...list]), but I'd rather reuse the same array to reduce GC pressure (And I also have a considerable amount of code that mutates arrays rather than reallocating. It would be a pain to change it all).

Additionally, is my other export from the JS file 'idiomatic' for global state using runes? Is there a more rune-idiomatic way of writing what I have?

Reproduction

Edit: updated other.js -> other.svelte.js

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACp2SsW7bMBCGX-XAFrAMGNLuyCqCdMmQMehgeVCks8WY4gkkFTcQNOYNOhbo0ifrE-QRehQVx0DcBsgiisf_7n4ev15spUIrlute6KJBsRSXbSsWwj22fmMfUDnkvaXOlD6S2tLI1mW5zp1sWjIOeiBXo4EBtoYayEWcjIE4ZMf3NhcXrOcMhQ6UtA5W8Nm6wmG0zkUtc7GZT4qSNB-3na1ZE81hlUHv45zLebE_iELKmDHFWeuXKeJrkMJY0S7y4aAc-Jsmr_Z1etc5RxpIL0sly_2q99WH7LKqYFbLGTiCkviOGvVkO7ryQrjBeZqEbK6U2rbQ2Tcyewt_fj5xD7_nOKlxTP0nLMo6FCgsr0OwmSqZ9bxLE_7hgJcmXjp4oyH5jMkw21OrqBSNbsM7vOf0K6HVMwcHdvzl-dfvH_9yHDp9xDcT01AltxIrsXSmw2FxBOyUjVfS7u0pZec58fc8ooLfR_gCL-Hiq4DK7iWZ8enBoOuMDnjAsPCCEaL5Wa5CiwAMwFu0kgRuNUPRMBJS74D7wh0qOrBII3RtxWbtGL69XgBPHq550J2qWLBH_0gV8bG0cJCuJj4vFemXUoUxxeOx09R-HcfjI2z-S3euPeBvB78Z_gJmEFQX5QMAAA==

Logs

No response

System Info

N/A

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions