Introduce a RelationPicker component with a RelationPickerScope (#2617)

Refactor mainIdentifier into scope componetn
This commit is contained in:
Charles Bochet
2023-11-21 16:09:02 +01:00
committed by GitHub
parent d25f00e04f
commit f97d25d986
25 changed files with 256 additions and 168 deletions

View File

@ -1,4 +1,3 @@
import { useObjectMainIdentifier } from '@/object-metadata/hooks/useObjectMainIdentifier';
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
@ -20,18 +19,7 @@ export const useRelationFieldPreview = ({
skip: skipDefaultValue || !relationObjectMetadataItem,
});
const {
labelIdentifierFieldPaths,
imageIdentifierUrlField,
imageIdentifierUrlPrefix,
imageIdentifierFormat,
} = useObjectMainIdentifier(relationObjectMetadataItem);
return {
defaultValue: relationObjects?.[0],
labelIdentifierFieldPaths,
imageIdentifierUrlField,
imageIdentifierUrlPrefix,
imageIdentifierFormat,
};
};