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:
+17
-3
@@ -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[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user