diff --git a/src/libs/actions/IOU/ReportWorkflow.ts b/src/libs/actions/IOU/ReportWorkflow.ts index 85979aef0917..4c0d6c386b86 100644 --- a/src/libs/actions/IOU/ReportWorkflow.ts +++ b/src/libs/actions/IOU/ReportWorkflow.ts @@ -454,7 +454,12 @@ function approveMoneyRequest(params: ApproveMoneyRequestFunctionParams) { rules, }); - const parentChatKeys = new Set([`${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport.reportID}`]); + // A vacation delegate can approve before the policy chat is ever loaded, so chatReport is missing. + // Hold skips parent-chat updates in that case; fall back to the id on the expense report so the filter still matches when the chat is loaded. + const parentChatReportID = chatReport?.reportID ?? expenseReport.chatReportID; + const parentChatKeys = new Set( + parentChatReportID ? [`${ONYXKEYS.COLLECTION.REPORT}${parentChatReportID}`, `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentChatReportID}`] : [], + ); const shouldSkipParentChatUpdates = expenseReport.hasParentAccess === false; const filterParentChatUpdates = (updates: TUpdate[]) => shouldSkipParentChatUpdates ? updates.filter((update) => !parentChatKeys.has(update.key)) : updates;