You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the page back browser button, an array declared with $state is not reactive when using reassignment to change its value in firefox
Reproduction
let favourites = $state([])
onMount(() => {
//this is a network promise in the actual code
Promise.resolve({"favourites": [1, 2, 3]}).then(res => {
//-----this causes the state to not update
favourites = res["favourites"];
//----
//===but when using this, it works
favourites.length = 0;
for(let a of res["favourites"]){
favourites.push(a);
}
//====
})
})
System Info
Observed only in firefox (my version - Mozilla Firefox 128.5.0esr)- not in chromium, AND only when "Disable cache"in network dev tools is turned off
Severity
annoyance
The text was updated successfully, but these errors were encountered:
thanks for the reply- as mentioned, this was only observed in firefox 128.5, when navigating back a page, AND having disabled network cache, so I presume you won’t see it in the playground with a non network request.
I don’t have my code with me (I can upload it later), but replacing the promise with a call to an endpoint returning that json is basically the entire code.
Describe the bug
When using the page back browser button, an array declared with $state is not reactive when using reassignment to change its value in firefox
Reproduction
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: