-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Description
Vue version
3.5.24
Link to minimal reproduction
Steps to reproduce
The repro shows that computedList[0] and list[0] are not the same object when using list.value.forEach to push the array elements into another list.
If you uncomment the imperative style for loop (and comment the forEach) then you will see the computedList[0] and list[0] are now the same object.
What is expected?
Both the initial code and the commented code should have the same effect i.e Accessing the array elements via forEach (or map, or filter, or find etc.) should return the same result as accessing via index.
What is actually happening?
The elements in the callback of the .forEach are MutableReactiveHandler proxies (as can be confirmed by console.log). The elements accessed via index (and what you'd expect in a readonly array) are ReadonlyReactiveHandler proxies.
This seems to affect all the methods which iterate through the array and provide elements in a callback including for...of loops
System Info
Any additional comments?
No response