Skip to content

Commit 4e09237

Browse files
chore: use memo for canEditReport
1 parent 7c5ec09 commit 4e09237

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/components/ReportActionItem/MoneyRequestView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,10 @@ function MoneyRequestView({
233233
const canEditReceipt = canUserPerformWriteAction && canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.RECEIPT, undefined, isChatReportArchived);
234234
const canEditDistance = canUserPerformWriteAction && canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.DISTANCE, undefined, isChatReportArchived);
235235
const canEditDistanceRate = canUserPerformWriteAction && canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.DISTANCE_RATE, undefined, isChatReportArchived);
236-
const canEditReport =
237-
canUserPerformWriteAction && canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.REPORT, undefined, isChatReportArchived, outstandingReportsByPolicyID);
236+
const canEditReport = useMemo(
237+
() => canUserPerformWriteAction && canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.REPORT, undefined, isChatReportArchived, outstandingReportsByPolicyID),
238+
[canUserPerformWriteAction, parentReportAction, isChatReportArchived, outstandingReportsByPolicyID],
239+
);
238240

239241
// A flag for verifying that the current report is a sub-report of a expense chat
240242
// if the policy of the report is either Collect or Control, then this report must be tied to expense chat

0 commit comments

Comments
 (0)