From f07a1d80947f58d6ac5d86c878f8bae9dbbe158b Mon Sep 17 00:00:00 2001 From: paulnjs Date: Wed, 11 Nov 2026 00:46:41 +0700 Subject: [PATCH] fix: Investigate workflow job failing on main test (job 4) --- src/libs/actions/IOU/ReportWorkflow.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;