You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expense - New report appears briefly after creating new report from self DM #88425
Version Number: 9.3.61-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#84832 Email or phone of affected tester (no customers):osijdnosijdosjdoij@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Set Submission to Instantly.
Disable Approvals and Payments.
Workspace has no open report.
Go to staging.new.expensify.com
Go to self DM..
Create a non-reimbursable expense.
Open the expense.
Click Report field.
Click Create report.
Click Report field.
Expected Result:
In Step 6, report will not appear briefly after creating a new report.
Actual Result:
In Step 6, report appears briefly after creating a new report.
In Step 7, the new report in Step 6 disappears.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #84832 - "Fix: Filter ineligible reports in useOutstandingReports hook" by @abzokhattab (High confidence) Related Issues: #70423 (the original issue PR #84832 was fixing)
Recommendation: REVERT
PR #84832 introduced filtering logic in useOutstandingReports that causes newly created reports to disappear from the report selection list under specific workspace conditions, directly matching the reported regression.
src/hooks/useOutstandingReports.ts — the hook consumed by ReportField.tsx (the component rendered when the user clicks the Report field on the confirmation page)
PR modifies the exact code path triggered by the bug:
ReportField.tsx calls useOutstandingReports at line 112 to determine if the Report field is interactive and what reports to show.
isReportIneligibleForMoveExpenses in src/libs/ReportUtils.ts (line 2788) returns true when:
The workspace has Instant Submit enabled (autoReporting: true, autoReportingFrequency: INSTANT)
The workspace has Submit & Close (no approvals/payments — approvalMode: OPTIONAL)
The report contains only non-reimbursable transactions (hasOnlyNonReimbursableTransactions returns true)
The timing issue in the reported bug:
Step 6 — "Create report": The freshly created report has zero transactions. hasOnlyNonReimbursableTransactions returns false when there are no transactions (line 2619-2621: if transactions.length === 0 return false). The new report passes the filter and briefly appears.
Step 7 — click Report field again: By now the non-reimbursable expense transaction has been optimistically associated with the new report in Onyx. hasOnlyNonReimbursableTransactions now returns true. With Instant Submit + Submit & Close, isReportIneligibleForMoveExpenses returns true, so the new report is filtered out and disappears.
The PR intended to prevent users from moving expenses to reports that would immediately auto-close (causing a 403 server error), but the filtering is applied too broadly — it also removes the report the user is actively trying to select or just created as a destination.
The policy has submit-and-close (no approvals), AND
The report has only non-reimbursable transactions
When "Create report" is tapped, createReportForPolicy creates an empty optimistic report (0 transactions) and then moves the transaction in a deferred microtask via setNavigationActionToMicrotaskQueue. During the gap between report creation and transaction move:
Once the transaction is moved, hasOnlyNonReimbursableTransactions returns true → isReportIneligibleForMoveExpenses returns true → report is filtered out → it disappears
Additionally, the server response to CHANGE_TRANSACTIONS_REPORT likely closes the report entirely (stateNum → APPROVED) for submit-and-close policies with only non-reimbursable transactions, which removes it from the derived OUTSTANDING_REPORTS_BY_POLICY_ID value as well.
What changes do you think we should make in order to solve the problem?
In isReportIneligibleForMoveExpenses, add an exemption for reports that are still being created (have pendingFields.createReport === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD), similar to the existing isDraftReport exemption. This prevents the newly-created report from being filtered out before the optimistic flow completes:
function isReportIneligibleForMoveExpenses(moneyRequestReport, policy) {
if (isDraftReport(moneyRequestReport?.reportID)) {
return false;
}
if (moneyRequestReport?.pendingFields?.createReport === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) {
return false;
}
return isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && hasOnlyNonReimbursableTransactions(moneyRequestReport?.reportID);
}
This ensures the report remains visible during the optimistic create → move flow. Once the server confirms the creation (clearing pendingFields.createReport), the normal eligibility logic takes over.
What alternative solutions did you explore? (Optional)
An alternative would be to make changeTransactionsReport run synchronously with createNewReport instead of being deferred to a microtask, but that would require changes to the navigation flow and could introduce other timing issues.
src/libs/actions/OnyxDerived/configs/outstandingReportsByPolicyID.ts:25-30 — derived value filters reports with stateNum <= SUBMITTED
Data flow:
User clicks "Create report" → createNewReport writes empty optimistic report to Onyx (0 transactions, pendingFields.createReport = ADD)
Report passes filterEligibleReports (0 transactions → not ineligible) → appears in list
Microtask fires → changeTransactionsReport moves non-reimbursable transaction to report
hasOnlyNonReimbursableTransactions now returns true → isReportIneligibleForMoveExpenses returns true → report filtered out
Server response likely closes report (stateNum → APPROVED) → removed from derived outstanding reports
Reproducible in production? No — this is staging-only per the issue report, which aligns with the hypothesis since submit-and-close behavior may differ between environments.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Activity
melvin-bot commentedon Apr 21, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #84832
melvin-bot commentedon Apr 21, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Apr 21, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
OSBotify commentedon Apr 21, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #84832 - "Fix: Filter ineligible reports in useOutstandingReports hook" by @abzokhattab (High confidence)
Related Issues: #70423 (the original issue PR #84832 was fixing)
Recommendation: REVERT
PR #84832 introduced filtering logic in
useOutstandingReportsthat causes newly created reports to disappear from the report selection list under specific workspace conditions, directly matching the reported regression.Assigned: @abzokhattab (PR author), @grgia (approving reviewer), @huult (approving reviewer) from highest-confidence causing PR only
Labels:
DeployBlockerCashkept (Frontend bug — App PR caused this).DeployBlockerremoved (no backend change required).Detailed Analysis
Evidence
grgia) to this issue.Verification
Affected files from PR #84832:
src/hooks/useOutstandingReports.ts— the hook consumed byReportField.tsx(the component rendered when the user clicks the Report field on the confirmation page)PR modifies the exact code path triggered by the bug:
ReportField.tsxcallsuseOutstandingReportsat line 112 to determine if the Report field is interactive and what reports to show.filterEligibleReportswhich callsisReportIneligibleForMoveExpenseson every report returned by the hook.Root Cause
isReportIneligibleForMoveExpensesinsrc/libs/ReportUtils.ts(line 2788) returnstruewhen:autoReporting: true,autoReportingFrequency: INSTANT)approvalMode: OPTIONAL)hasOnlyNonReimbursableTransactionsreturnstrue)The timing issue in the reported bug:
hasOnlyNonReimbursableTransactionsreturnsfalsewhen there are no transactions (line 2619-2621:if transactions.length === 0 return false). The new report passes the filter and briefly appears.hasOnlyNonReimbursableTransactionsnow returnstrue. With Instant Submit + Submit & Close,isReportIneligibleForMoveExpensesreturnstrue, so the new report is filtered out and disappears.The PR intended to prevent users from moving expenses to reports that would immediately auto-close (causing a 403 server error), but the filtering is applied too broadly — it also removes the report the user is actively trying to select or just created as a destination.
MelvinBot commentedon Apr 21, 2026
Proposal
What is the root cause of that problem?
PR #84832 introduced
filterEligibleReportsin theuseOutstandingReportshook, which callsisReportIneligibleForMoveExpenses. This function marks a report as ineligible when:When "Create report" is tapped,
createReportForPolicycreates an empty optimistic report (0 transactions) and then moves the transaction in a deferred microtask viasetNavigationActionToMicrotaskQueue. During the gap between report creation and transaction move:hasOnlyNonReimbursableTransactionsreturnsfalse(0 transactions) → report is eligible → it appearshasOnlyNonReimbursableTransactionsreturnstrue→isReportIneligibleForMoveExpensesreturnstrue→ report is filtered out → it disappearsAdditionally, the server response to
CHANGE_TRANSACTIONS_REPORTlikely closes the report entirely (stateNum → APPROVED) for submit-and-close policies with only non-reimbursable transactions, which removes it from the derivedOUTSTANDING_REPORTS_BY_POLICY_IDvalue as well.What changes do you think we should make in order to solve the problem?
In
isReportIneligibleForMoveExpenses, add an exemption for reports that are still being created (havependingFields.createReport === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD), similar to the existingisDraftReportexemption. This prevents the newly-created report from being filtered out before the optimistic flow completes:This ensures the report remains visible during the optimistic create → move flow. Once the server confirms the creation (clearing
pendingFields.createReport), the normal eligibility logic takes over.What alternative solutions did you explore? (Optional)
An alternative would be to make
changeTransactionsReportrun synchronously withcreateNewReportinstead of being deferred to a microtask, but that would require changes to the navigation flow and could introduce other timing issues.Investigation details
Key code locations:
src/hooks/useOutstandingReports.ts:25-29—filterEligibleReportsintroduced by PR Fix: Filter ineligible reports in useOutstandingReports hook #84832src/libs/ReportUtils.ts:2788-2793—isReportIneligibleForMoveExpensessrc/libs/ReportUtils.ts:2617-2624—hasOnlyNonReimbursableTransactionsreturnsfalsefor 0 transactionssrc/pages/iou/request/step/IOURequestStepReport.tsx:239-247—createReportForPolicycreates report then defers transaction movesrc/libs/ReportUtils.ts:6916-6962—buildOptimisticEmptyReportsetspendingFields.createReport = ADDsrc/libs/actions/OnyxDerived/configs/outstandingReportsByPolicyID.ts:25-30— derived value filters reports withstateNum <= SUBMITTEDData flow:
createNewReportwrites empty optimistic report to Onyx (0 transactions,pendingFields.createReport = ADD)filterEligibleReports(0 transactions → not ineligible) → appears in listchangeTransactionsReportmoves non-reimbursable transaction to reporthasOnlyNonReimbursableTransactionsnow returnstrue→isReportIneligibleForMoveExpensesreturnstrue→ report filtered outReproducible in production? No — this is staging-only per the issue report, which aligns with the hypothesis since submit-and-close behavior may differ between environments.
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.huult commentedon Apr 21, 2026
@abzokhattab could you check this issue?