fix: fix Settings field form validation for certain field types (#5335)
Related to #4295 Following #5326, field types other than: - `FieldMetadataType.Boolean` - `FieldMetadataType.Currency` - `FieldMetadataType.Relation` - `FieldMetadataType.Select` - `FieldMetadataType.MultiSelect` Cannot be saved as they are not included in the form validation schema. This PR makes sure they are included and can therefore be created/edited.
This commit is contained in:
@ -110,8 +110,9 @@ export const SettingsObjectFieldEdit = () => {
|
||||
try {
|
||||
if (
|
||||
formValues.type === FieldMetadataType.Relation &&
|
||||
isNonEmptyString(relationFieldMetadataItem?.id) &&
|
||||
'relation' in dirtyFields
|
||||
'relation' in formValues &&
|
||||
'relation' in dirtyFields &&
|
||||
isNonEmptyString(relationFieldMetadataItem?.id)
|
||||
) {
|
||||
await updateOneFieldMetadataItem({
|
||||
fieldMetadataIdToUpdate: relationFieldMetadataItem.id,
|
||||
|
||||
@ -211,7 +211,8 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
const createdMetadataField = await createMetadataField({
|
||||
...formValues,
|
||||
defaultValue:
|
||||
formValues.type === FieldMetadataType.Currency
|
||||
formValues.type === FieldMetadataType.Currency &&
|
||||
'defaultValue' in formValues
|
||||
? {
|
||||
...formValues.defaultValue,
|
||||
amountMicros: null,
|
||||
|
||||
Reference in New Issue
Block a user