Describe the bug
When we used an $state([]), some basic function of Array have an incorrect behavior with object.
It seems that all equality operations fail, as the object in the array is a proxy.
let array = $state([]);
const obj = { data: "any value" };
array.push(obj);
console.log( array[0] === obj ); // false !!!
console.log( array.indexOf(obj) ); // -1 !!!
console.log( array.findIndex(n => n === obj) ); // -1 !!!
It’s really disturbing and not easy to understand...
Reproduction
Exemple in REPL : the buttons addRandomNumber, addRandomString and addRandomObject add a number/string/object in an array, and logs the index.
This works as espected for number and string, but fails for objects.
REPL
Logs
No response
System Info
Severity
annoyance