Subscribe on changes!

props definition: mutating referenced object by adding array indexes

avatar
Oct 20th 2022

Vue version

3.2.41

Link to minimal reproduction

https://codesandbox.io/s/brave-blackburn-rpbrmo?file=/src/components/Image.vue:91-135

Steps to reproduce

Look at the console of the codesandbox to see the logs and what props has done to the props object.

Create a component, in the script tag create variable and assign an object to it, in that object specify your props. In your component options api for props, reference the variable, console log the variable and notice that vue has modified the object and added array indexes to it. Now this object is useless because it cannot be used in other components for defining props.

What is expected?

Vue not to mutate objects because this stops it being used elsewhere.

What is actually happening?

Vue is mutating an object which it shouldnt be doing

System Info

No response

Any additional comments?

No response