Skip to content

Commit

Permalink
avniproject/avni-client#1544 | Optimize search for parentFormElement …
Browse files Browse the repository at this point in the history
…using hashMap
  • Loading branch information
himeshr committed Nov 8, 2024
1 parent 0e3ce47 commit c702faf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/application/FormElementGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,11 @@ class FormElementGroup extends BaseEntity {
}

nonVoidedFormElements() {
const mapOfFormElementsByUUID = _.keyBy(this.formElements, 'uuid');
return _.filter(this.formElements, (formElement) => {
let parentFormElement;
if (!_.isNil(formElement.groupUuid))
parentFormElement = _.find(this.formElements, (fe) => fe.uuid === formElement.groupUuid);
parentFormElement = mapOfFormElementsByUUID[formElement.groupUuid];
return !formElement.voided && (_.isNil(parentFormElement) || !parentFormElement.voided);
});
}
Expand Down

0 comments on commit c702faf

Please sign in to comment.