Skip to content

Commit

Permalink
chore: review
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Nov 21, 2023
1 parent e5013c3 commit df3462e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export type Props = {|
theme: Theme,
programId: string,
orgUnitId: string,
originTeiId: ?string,
inheritedAttributes: Array<InputAttribute>,
enrollmentMetadata?: Enrollment,
onSave: SaveForEnrollmentAndTeiRegistration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ type Return = {
};
export const useInheritedAttributeValues = ({ teiId, trackedEntityTypeId }: Props): Return => {
const trackedEntityType = getTrackedEntityTypeThrowIfNotFound(trackedEntityTypeId);
const inheritedAttributeIds = new Set<string>(
trackedEntityType.attributes
.filter(attribute => attribute.inherit)
.map(attribute => attribute.id),
);
const inheritedAttributeIds = trackedEntityType.attributes?.reduce((acc, attribute) => {
if (attribute.inherit) {
acc.add(attribute.id);
}
return acc;
}, new Set());

const { data, isLoading } = useApiDataQuery(
['inheritedAttributeValues', teiId],
Expand Down

0 comments on commit df3462e

Please sign in to comment.