fix relation creation bug (#11848)

Context : In `RelationToOneFieldDisplay`, the `objectNameSingular` used
for the chip calculation was incorrect - it was using the value from the
opposite side of the relationship. Then, labelIdentifier based on
composite fields were causing errors (People and WorkspaceMembers with
name)


<img width="300" alt="Screenshot 2025-05-03 at 08 03 46"
src="https://github.com/user-attachments/assets/8d034700-5244-4b1b-978e-f77ae78b6ceb"
/>


Tested everywhere FieldDisplay is used. 
Tested for each both relation type. 

closes https://github.com/twentyhq/twenty/issues/11826
This commit is contained in:
Etienne
2025-05-03 08:21:33 +02:00
committed by GitHub
parent ea0f45e782
commit 9d5f4bf8fd

View File

@ -60,9 +60,8 @@ export const useRelationToOneFieldDisplay = () => {
: (record: ObjectRecord) =>
generateDefaultRecordChipData({
record,
// @ts-expect-error Above assertions does not infer that fieldDefinition.metadata.objectMetadataNameSingular always defined
objectNameSingular:
fieldDefinition.metadata.objectMetadataNameSingular,
fieldDefinition.metadata.relationObjectMetadataNameSingular,
});
return {