twenty
twenty copied to clipboard
Custom fields lacks empty tag
Bug Description
- Custom fields lacks empty tag as a result they have very limited clickable area to edit them.
- This creates a lot of whitespaces in front of fields which hinders the design
Current behavior
Expected
There should be empty tags in front of custom fields when empty
I cannot reproduce the bug 🤔 Any idea/ more context?
There was a mistake from my side on providing enough context @Bonapara. As you can see in the screen recording below, custom fields create empty spaces under company.
https://github.com/user-attachments/assets/cca98fd3-e4d4-467f-b0cc-ba6c049cf322
Could reproduce for relation custom fields in dropdowns, thanks @harshit078!
/oss.gg 200
Thanks for opening an issue! It's live on oss.gg!
Hi, is this available to be taken? Can I work on this?
Hi @Bonapara , I did some inspection and it seems like the Empty tag is missing for Multi-select and One-to-many data type. The problem lies in the check isDisplayModeContentEmpty for empty content, which is referring to function isFieldValueEmpty()
https://github.com/twentyhq/twenty/blob/1b99a05dec535167b68b062e1680f3dc7eebaa2b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellDisplayMode.tsx#L89-L94
From what I understand, the isFieldValueEmpty() doesn't properly check if the array is empty. My solution would be adding changes to isFieldValueEmpty() to check the empty array for fields multi-select and relation.
Please let me know if I'm on the right track or if there's anything I've misunderstood. Thank you!
@lucasbordeau WDYT?
@nganphan123 yes it seems you're on the right track! Thank you!
@nganphan123 fyi we never really shiped relationToOne in the product in the end.
I'd probably do something like this instead (not tested):
if (isFieldRelation(fieldDefinition)) {
if(isFieldRelationToOneValue(fieldValue)) {
return isValueEmpty(fieldValue);
}
return !isNonEmptyArray(fieldValue);
}
Close to what you're saying but better handling of RelationToOne imo (even though we don't use it)
@FelixMalfait I see. I added the change and it passed the tests. Also, isFieldRelationToOneValue and isFieldRelationFromManyValue have the same implementation so it didn't identify which field is RelationToMany, so I changed to isArray instead.
if (isFieldRelation(fieldDefinition)) {
if (isArray(fieldValue)) {
return !isNonEmptyArray(fieldValue);
}
return isValueEmpty(fieldValue);
}
@FelixMalfait this issue can be closed since changes are merged
Thanks @BOHEUS