Fix add related records to activity target after object renaming (#16953)
Fixes https://github.com/twentyhq/twenty/issues/16928 and https://github.com/twentyhq/private-issues/issues/400 When an object is renamed, its corresponding relation field on noteTarget and taskTarget are not renamed. This caused an issue as in the FE, we used the related record object name to compute the field name used in the payload. This PR addresses it by, instead, finding the field name after identifying it thanks to the object id. To reproduce, you can rename an object then try to tie it to a note.
This commit is contained in:
+4
-2
@@ -28,12 +28,14 @@ export const useActivityTargetsForTargetableObjects = ({
|
||||
activityTargetsOrderByVariables: RecordGqlOperationOrderBy;
|
||||
limit: number;
|
||||
}) => {
|
||||
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
|
||||
|
||||
const activityTargetsFilter = getActivityTargetsFilter({
|
||||
targetableObjects: targetableObjects,
|
||||
activityObjectNameSingular: objectNameSingular,
|
||||
objectMetadataItems,
|
||||
});
|
||||
|
||||
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
|
||||
|
||||
const FIND_ACTIVITY_TARGETS_OPERATION_SIGNATURE =
|
||||
findActivityTargetsOperationSignatureFactory({
|
||||
objectNameSingular,
|
||||
|
||||
Reference in New Issue
Block a user