Subscribe on changes!

Unexpected behaviour when making prop (ref) object reactive

avatar
Mar 14th 2023

This appears to be working correctly to me.

msg.value and props.updateFileData are the same object. This is creating a shallow copy of that object:

const formData = reactive({
  ...props.updateFileData
});

So formData is a different object. But the nested object in msg.value.test and props.updateFileData.test is the same object as formData.test. Try adding {{ updateFileData.test === formData.test }} to your template, it should confirm that they are the same object.

If you have further questions about this I suggest asking on the Vue Discord at https://chat.vuejs.org/.