Skip to content

Commit cb8dd70

Browse files
committed
fix: don't use reduce
1 parent 7f22699 commit cb8dd70

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/pages/home/report/ReportActionItemParentAction.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ function ReportActionItemParentAction({
8686
const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS, {
8787
canBeMissing: true,
8888
selector: (allPairs) => {
89-
const ancestorIDsToSelect = new Set(allAncestors.map(({report: reportAncestor}) => reportAncestor.reportID));
90-
return Object.entries(allPairs ?? {}).reduce((acc, [key, value]) => {
91-
const id = key.split('_').at(1);
92-
if (id && ancestorIDsToSelect.has(id) && acc) {
93-
acc[key] = value;
94-
}
95-
return acc;
96-
}, {} as OnyxCollection<OnyxTypes.ReportNameValuePairs>);
89+
const ancestorIDsToSelect = new Set(ancestorIDs.current.reportIDs);
90+
91+
return Object.fromEntries(
92+
Object.entries(allPairs ?? {}).filter(([key]) => {
93+
const id = key.split('_').at(1);
94+
return id && ancestorIDsToSelect.has(id);
95+
}),
96+
);
9797
},
9898
});
9999

0 commit comments

Comments
 (0)