exclusive-coralE
Refine17mo ago
9 replies
exclusive-coral

Create or Edit components passes empty object {} for relations if their value is not provided

<Form.Item
  label={"Category"}
  name={["category", "id"]}
  initialValue={formProps.initialValues?.category?.id}
>
  <Select {...categorySelectProps} />
</Form.Item>
<Form.Item
  label={"Brand"}
  name={["brand", "id"]}
  initialValue={formProps.initialValues?.category?.id}
>
  <Select {...brandSelectProps} />
</Form.Item>


With this code, it posts below data

{
    "title": "test1",
    "sku": "TEST123",
    "price": 45,
    "description": "asd",
    "category": {},
    "brand": {}
}


TypeORM is not able to process empty objects when they are lack of id property for create and edit
Was this page helpful?