fix: removeuseMergeRecordRelatationship and simplify dry run response (#15486)

## Description

- This PR addresses issue
https://github.com/twentyhq/twenty/issues/15201
- Removed
[useMergeRecordRelationships.ts](https://github.com/twentyhq/twenty/compare/main...harshit078:fix-merge-frontend?expand=1#diff-5d0366f814ff0c0e8961f40120690206a7acd3f7b66135cfb8c4ad8d3f6bc681)
- now backend returns populated result and frontend just shows it
without refetching relations.
- to be merged after PR- https://github.com/twentyhq/twenty/pull/15484


## Visual Appearance

 


https://github.com/user-attachments/assets/09d7548a-74a9-4742-af49-e98b4174f68c

---------

Co-authored-by: Etienne <45695613+etiennejouan@users.noreply.github.com>
This commit is contained in:
Harshit Singh
2025-11-05 15:03:24 +05:30
committed by GitHub
parent 642e0c882a
commit 003b04e9ae
4 changed files with 28 additions and 174 deletions
@@ -134,9 +134,6 @@ export class CommonMergeManyQueryRunnerService extends CommonBaseQueryRunnerServ
const recordsToMerge = await context.repository.find({
where: { id: In(args.ids) },
select: columnsToSelect,
...(args.dryRun
? { relations: args.selectedFieldsResult.relations }
: {}),
});
if (recordsToMerge.length !== args.ids.length) {
@@ -146,6 +143,23 @@ export class CommonMergeManyQueryRunnerService extends CommonBaseQueryRunnerServ
);
}
if (args.dryRun && args.selectedFieldsResult.relations) {
await this.processNestedRelationsHelper.processNestedRelations({
objectMetadataMaps: context.objectMetadataMaps,
parentObjectMetadataItem: context.objectMetadataItemWithFieldMaps,
parentObjectRecords: recordsToMerge as ObjectRecord[],
relations: args.selectedFieldsResult.relations as Record<
string,
FindOptionsRelations<ObjectLiteral>
>,
limit: QUERY_MAX_RECORDS,
authContext: context.authContext,
workspaceDataSource: context.workspaceDataSource,
rolePermissionConfig: context.rolePermissionConfig,
selectedFields: args.selectedFieldsResult.select,
});
}
return recordsToMerge as ObjectRecord[];
}