diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index a4fdf92257..c18c1ddc8a 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -877,10 +877,13 @@ class BaseModelSqlv2 { } async multipleHmList( - { colId, ids }, + { colId, ids: _ids }: { colId: string; ids: any[] }, args: { limit?; offset?; fieldsSet?: Set } = {}, ) { try { + // skip duplicate id + const ids = [...new Set(_ids)]; + const { where, sort, ...rest } = this._getListArgs(args as any); // todo: get only required fields @@ -1136,9 +1139,17 @@ class BaseModelSqlv2 { } public async multipleMmList( - { colId, parentIds }, + { + colId, + parentIds: _parentIds, + }: { + colId: string; + parentIds: any[]; + }, args: { limit?; offset?; fieldsSet?: Set } = {}, ) { + // skip duplicate id + const parentIds = [...new Set(_parentIds)]; const { where, sort, ...rest } = this._getListArgs(args as any); const relColumn = (await this.model.getColumns()).find( (c) => c.id === colId, @@ -1213,7 +1224,7 @@ class BaseModelSqlv2 { }), GROUP_COL, ); - return parentIds.map((id) => gs[id] || []); + return _parentIds.map((id) => gs[id] || []); } public async mmList(