#v6-v7 form migration help

4 messages · Page 1 of 1 (latest)

lone axle
#

was there an update to how useform handle list item updates using setFieldValue / insertListItem?

I get errors like

Cannot assign to read only property 'x' of object '#<Object>'
TypeError: Cannot assign to read only property 'x' of object '#<Object>'
#

PS: I am passing the form object as a prop using UseFormReturnType

And when i use lodash deepClone there is no issue. I'm just confused why this started happening as soon as i got on v7.

form interface looks like this

export interface Test {
    name: string
    model: string
    visual: {
        id: string
        items: { x: string, y: string, id: string, values?: string[]}


    }
}
slim stone
#

Probably your object is frozen/made read only other way by other library that you use or your own code. It is hard to tell what is wrong without a minimal reproduction.

lone axle
#

that is my theory. The issue occurs in set-path.ts , which from the look of it uses klona to create a clone so confusing why it doesnt work here.

Anyways I think in general i know how to work around it was just curious why it wasnt working, thank you!