Complete labelIdentifer, relationPicker first implementation (#2618)
* Fix first column main identifier * Fixes
This commit is contained in:
@ -26,7 +26,10 @@ export const useFieldPreview = ({
|
||||
const fieldName = fieldMetadata.id
|
||||
? objectMetadataItem?.fields.find(({ id }) => id === fieldMetadata.id)?.name
|
||||
: undefined;
|
||||
const value = fieldName ? firstRecord?.[fieldName] : undefined;
|
||||
const value =
|
||||
fieldMetadata.type !== 'RELATION' && fieldName
|
||||
? firstRecord?.[fieldName]
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
entityId: firstRecord?.id || `${objectMetadataId}-no-records`,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
|
||||
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
|
||||
import { capitalize } from '~/utils/string/capitalize';
|
||||
|
||||
export const useRelationFieldPreview = ({
|
||||
relationObjectMetadataId,
|
||||
@ -20,6 +21,9 @@ export const useRelationFieldPreview = ({
|
||||
});
|
||||
|
||||
return {
|
||||
defaultValue: relationObjects?.[0],
|
||||
relationObjectMetadataItem,
|
||||
defaultValue: relationObjects?.[0] ?? {
|
||||
name: capitalize(relationObjectMetadataItem?.nameSingular ?? ''),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user