From cb5d9864d5802cc44dc5f4e076fbda22054195e3 Mon Sep 17 00:00:00 2001 From: shubhamsharma9199 Date: Tue, 4 Nov 2025 00:15:16 +0530 Subject: [PATCH] fix(entity-data-table-checks): optimize setEntity() to prevent UI lag on large datasets --- .../entity-data-table-checks.component.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/organization/entity-data-table-checks/entity-data-table-checks.component.ts b/src/app/organization/entity-data-table-checks/entity-data-table-checks.component.ts index 0583119e7..b725878d3 100644 --- a/src/app/organization/entity-data-table-checks/entity-data-table-checks.component.ts +++ b/src/app/organization/entity-data-table-checks/entity-data-table-checks.component.ts @@ -124,17 +124,18 @@ export class EntityDataTableChecksComponent implements OnInit { this.setEntity(); } - /** - * Sets Entity to its corresponding values - */ setEntity() { - for (let i = 0; i < this.dataSource.data.length; i++) { - for (let j = 0; j < this.entityValues.length; j++) { - if (this.entityValues[j].code === this.dataSource.data[i].entity) { - this.dataSource.data[i].entity = this.entityValues[j].value; - } + const entityMap = new Map(); + this.entityValues.forEach((entity: any) => { + entityMap.set(entity.code, entity.value); + }); + + this.dataSource.data.forEach((item: any) => { + const entityValue = entityMap.get(item.entity); + if (entityValue) { + item.entity = entityValue; } - } + }); } /**