Closed
Description
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
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