Fix display empty value if boolean instead of false on show page (#4468)

* default value boolean fixed

* fixed creation, fixed updating a value to false

* fixed default value for default value if boolean

* fixed tests

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
brendanlaschke
2024-03-30 11:38:08 +01:00
committed by GitHub
parent 1d351a29b8
commit da8f1b0a66
11 changed files with 136 additions and 15 deletions

View File

@ -300,10 +300,12 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
await fieldMetadataRepository.update(id, {
...updatableFieldInput,
defaultValue:
// Todo: we need to handle default value for all field types. Right now we are only allowing update for SELECt
existingFieldMetadata.type !== FieldMetadataType.SELECT
// Todo: we handle default value for all field types.
![FieldMetadataType.SELECT, FieldMetadataType.BOOLEAN].includes(
existingFieldMetadata.type,
)
? existingFieldMetadata.defaultValue
: updatableFieldInput.defaultValue
: updatableFieldInput.defaultValue !== null
? updatableFieldInput.defaultValue
: null,
// If the name is updated, the targetColumnMap should be updated as well