logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.79k stars 1.26k forks source link

TypeError: Cannot assign to read only property '__typename' of object #4889

Open hinogi opened 1 week ago

hinogi commented 1 week ago

It seems there is an issue here where some properties are readonly because it seems to be another proxy object. This results in unexpected error messages when simply assigning values to initalValues because it seems to try to reassign proxied properties which are writable: false.

https://github.com/logaretm/vee-validate/blob/f290933462db3e3499e158eef136bb30e5bc3942/packages/vee-validate/src/useForm.ts#L1289

hinogi commented 1 week ago

One strategy currently for me is to use structuredClone on the value before assigning them to initalValues

let initialValues = {};
initialValues.a = structuredClone(something.maybeproxy)

resetForm({ values: initalValues })
logaretm commented 3 days ago

Where did that state originate form? Vue-apollo?

hinogi commented 2 days ago

Yes, forwarded via props.