[Due for payment 2026-11-25] [$175] Ready to pay shows non-reimbursable-only reports until their transactions load
Problem
The Pay to-do ("Ready to pay") includes approved reports that contain only non-reimbursable expenses, if the transactions for those reports are not loaded yet. When the admin opens one of these reports, its transactions load and the report drops out of the Pay to-do. The count goes down by one.
These reports should never appear in the Pay to-do. Show Mark as paid on approved reports with nothing to reimburse made them pay-optional on purpose.
Steps to reproduce
- As a workspace admin, have several approved expense reports that contain only non-reimbursable expenses (for example, company card expenses). Do not open them in this session.
- Open the Spend page and look at the Ready to pay section and its count.
- Open one of the non-reimbursable-only reports, then go back.
Expected: Non-reimbursable-only reports never appear in Ready to pay.
Actual: They appear in Ready to pay until each report's transactions load. After you open a report, the count drops by one and that report disappears from the list.
Root cause
isPayOptional() decides only from loaded transactions:
- ReportUtils.ts:2997-3001:
hasOnlyNonReimbursableTransactions()returnsfalsefor an empty transaction list. - ReportUtils.ts:5500-5501:
hasSettledZeroReimbursableSpend()passes the report-total check but then requires at least one loaded expense. - TodosUtils.ts:164: the Pay bucket filters with
!isPayOptional(report, reportTransactions), so an unloaded report counts as payable.
The affected reports already have reimbursableTotal: 0 and nonReimbursableTotal equal to total on the report object.
Suggested fix
When a report's transactions are not loaded, use the report-level totals to decide whether pay is optional. Treat reimbursableTotal === 0 with a non-zero nonReimbursableTotal as pay-optional.
Keep the transaction-based check when transactions are loaded. hasSettledZeroReimbursableSpend() fails closed on purpose: a receipt that is still scanning can show $0 reimbursable even when it isn't. TodoBucketContext already has an areTransactionsLoaded flag (TodosUtils.ts:104) that you can use to tell "not loaded" apart from "no expenses".
This is a frontend-only fix.
Reported in Slack.
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022115882276320875460
- Upwork Job ID: 2115882276320875460
- Last Price Increase: 2026-10-29
Issue Owner
Current Issue Owner: @mallenexpensify
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jayeshmangwani (External)
Job added to Upwork: https://www.upwork.com/jobs/~022115882276320875460
@MelvinBot could you please draft a proposal for this issue using Expensify's standard guidelines?
Proposal
What is the root cause of that problem?
The Pay bucket hides pay-optional reports with !isPayOptional(report, reportTransactions). isPayOptional() only looks at loaded transactions. When a report's transactions are not in Onyx yet, reportTransactions is empty, so both checks return false:
hasOnlyNonReimbursableTransactions()returnsfalsefor an empty list.hasSettledZeroReimbursableSpend()passes the report-total checks, then requiresexpenses.length > 0.
The report then counts as payable, even though its report-level totals already say nothing is reimbursable.
Code references
- src/libs/TodosUtils.ts:164: Pay bucket filter
- src/libs/ReportUtils.ts:5508-5510:
isPayOptional() - src/libs/ReportUtils.ts:2997-3004: empty list returns
false - src/libs/ReportUtils.ts:5492-5502:
expenses.length > 0requirement - src/libs/ReportUtils.ts:3571: the LHN Pay badge calls
isPayOptional(iouReport)with no transactions, so it can show the same wrong result.
What changes do you think we should make in order to solve the problem?
In ReportUtils.ts, add a report-total fallback to isPayOptional() that applies only when the report has no loaded transactions:
- Add a helper, for example
hasOnlyNonReimbursableTotal(report). It returnstruewhen:- the report is an expense report,
- its total is loaded (
totalorreimbursableTotalis defined) and not pending (isReportTotalPending), getMoneyRequestSpendBreakdown(report)givesreimbursableSpend === 0andnonReimbursableSpend !== 0.
- In
isPayOptional(), resolve the report's transactions. If the list (excluding pending deletes) is empty, return the result of this helper. Otherwise, keep the current transaction-based checks unchanged.
This keeps the fail-closed behavior of hasSettledZeroReimbursableSpend() whenever transactions are loaded, for example a receipt that is still scanning. Because the fix is in isPayOptional(), the Pay to-do and the LHN Pay badge stay consistent.
Add unit tests:
ReportUtilsTest.ts:isPayOptional()returnstruefor an approved report withreimbursableTotal: 0, a non-zerononReimbursableTotal, and no transactions. It returnsfalsewhenreimbursableTotalis non-zero or the total is pending.TodosUtilsTest.ts: such a report is not inreportsToPaybefore its transactions load.
What alternative solutions did you explore? (Optional)
Gate the fallback on areTransactionsLoaded from TodoBucketContext, as the issue suggests. That flag only means the whole transaction collection has hydrated (TodosUtils.ts:103-104). It does not tell you whether one specific report's transactions were fetched. This bug is about reports whose transactions were never fetched, so the flag would often be true here and the bug would remain. An empty per-report list is the reliable signal, and an approved report with a non-zero nonReimbursableTotal cannot have zero expenses.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105413) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Proposal:
Please re-state the problem that we are trying to solve in this issue.
Approved expense reports that contain only non-reimbursable expenses (such as company card expenses) appear in the "Ready to pay" section and count towards the Pay to-do until the report is opened and its transactions load into Onyx. Once opened, the report drops out of "Ready to pay" and the count decreases. They should never appear in "Ready to pay" because paying them is optional (Mark as paid).
What is the root cause of that problem?
- In
src/libs/TodosUtils.ts:164, theCONST.SEARCH.SEARCH_KEYS.PAYbucket filters out pay-optional reports with!isPayOptional(report, reportTransactions). - In
src/libs/ReportUtils.ts:5474-5476,isPayOptionaldecides purely based on loaded transactions:function isPayOptional(report: OnyxInputOrEntry<Report>, transactionsParam?: Transaction[]): boolean { return hasOnlyNonReimbursableTransactions(report?.reportID, transactionsParam) || hasSettledZeroReimbursableSpend(getMoneyRequestSpendBreakdown(report), report, transactionsParam); } - When an approved report has not been opened yet in the session,
reportTransactionsis empty ([]). Both helper functions fail:hasOnlyNonReimbursableTransactionsreturnsfalsewhentransactions.length === 0(ReportUtils.ts:2994-2996).hasSettledZeroReimbursableSpendrequiresexpenses.length > 0(ReportUtils.ts:5467).
- As a result,
isPayOptionalreturnsfalse, causing!isPayOptional(report, reportTransactions)to evaluate totrue. The report is counted as payable inreportsToPayand in the LHN action badge (ReportUtils.ts:3558), even though the report object itself already hasreimbursableTotal === 0and a non-zerononReimbursableTotal.
What changes do you think we should make in order to solve the problem?
In src/libs/ReportUtils.ts:
-
Add a helper
hasOnlyNonReimbursableTotal(report)that checks whether the report's settled totals show only non-reimbursable spend:/** * Whether an expense report's loaded totals show only non-reimbursable spend and no reimbursable spend. * Used as a fallback when the report's transactions have not loaded yet. */ function hasOnlyNonReimbursableTotal(report: OnyxInputOrEntry<Report>): boolean { if (!isExpenseReport(report)) { return false; } const isTotalLoaded = report?.total !== undefined || report?.reimbursableTotal !== undefined; if (!isTotalLoaded || isReportTotalPending(report)) { return false; } const {reimbursableSpend, nonReimbursableSpend} = getMoneyRequestSpendBreakdown(report); return reimbursableSpend === 0 && nonReimbursableSpend !== 0; } -
Update
isPayOptionalto fall back tohasOnlyNonReimbursableTotal(report)when the resolved transactions list (excluding pending deletes) is empty:function isPayOptional(report: OnyxInputOrEntry<Report>, transactionsParam?: Transaction[]): boolean { const transactions = resolveReportTransactions(report?.reportID, transactionsParam).filter((transaction) => !isTransactionPendingDelete(transaction)); if (transactions.length > 0) { return hasOnlyNonReimbursableTransactions(report?.reportID, transactions) || hasSettledZeroReimbursableSpend(getMoneyRequestSpendBreakdown(report), report, transactions); } return hasOnlyNonReimbursableTotal(report); } -
Export
hasOnlyNonReimbursableTotalfromReportUtils.tsfor unit testing.
Why this solution is safe:
- When transactions are loaded, the exact existing transaction-based checks run unchanged.
- For $0 cancel-out reports (
reimbursableSpend === 0 && nonReimbursableSpend === 0),hasSettledZeroReimbursableSpendcontinues to fail closed until transactions load (protecting against receipts that are still smart-scanning). - Because
isPayOptionalis also used bygetBadgeFromIOUReport(ReportUtils.ts:3558), this fix simultaneously ensures consistency between the "Ready to pay" to-do bucket and the LHN Pay badge.
What alternative solutions did you explore? (Optional)
Using areTransactionsLoaded from TodoBucketContext in TodosUtils.ts:
Rejected because areTransactionsLoaded only tracks whether the global Onyx transaction collection has hydrated from disk (TodosUtils.ts:103-104). It does not indicate whether transactions for a specific individual report were fetched from the server. Furthermore, handling it in isPayOptional in ReportUtils.ts ensures that both TodosUtils and ReportUtils (LHN Pay badge) stay 100% in sync without duplicating fallback logic.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/ReportUtilsTest.ts under describe('isPayOptional'):
it('returns true when a non-reimbursable-only report has no loaded transactions', () => {
// Given an approved report whose totals show only non-reimbursable spend, but no transactions are loaded yet
const report: Report = {...expenseReport, total: -5000, nonReimbursableTotal: -5000, reimbursableTotal: 0};
// When checking whether paying it is optional with an empty transaction list
// Then it is optional, so it does not surface in Ready to pay before transactions load
expect(isPayOptional(report, [])).toBe(true);
});
it('returns false when transactions are not loaded and the report total is pending', () => {
// Given a report with non-reimbursable total whose total is still pending
const report: Report = {...expenseReport, total: -5000, nonReimbursableTotal: -5000, reimbursableTotal: 0, pendingFields: {total: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}};
// When checking whether paying it is optional
// Then it fails closed and returns false
expect(isPayOptional(report, [])).toBe(false);
});
In tests/unit/TodosUtilsTest.ts:
Add a test verifying that createTodosReportsAndTransactions excludes an approved report with reimbursableTotal: 0 and non-zero nonReimbursableTotal from reportsToPay when passed an empty transactions map.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~014bb7d4c250a1fe03
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
Approved expense reports that contain solely non-reimbursable expenses (such as company card charges) erroneously appear in the Ready to pay ("Pay") to-do bucket on the Spend page if their transactions have not been loaded into Onyx yet in the current session. Once an admin opens one of these reports, its transactions load into cache, and the report immediately disappears from "Ready to pay" while the badge count decrements by one.
What is the root cause of that problem?
In src/libs/TodosUtils.ts, the Pay to-do bucket filters out pay-optional reports using !isPayOptional(report, reportTransactions):
isPayOptional()insrc/libs/ReportUtils.ts:5471evaluates:return hasOnlyNonReimbursableTransactions(report?.reportID, transactionsParam) || hasSettledZeroReimbursableSpend(getMoneyRequestSpendBreakdown(report), report, transactionsParam);- When a report's transactions have not yet hydrated in Onyx,
resolveReportTransactions(iouReportID, transactionsParam)resolves to an empty array ([]). - Consequently:
hasOnlyNonReimbursableTransactions()atReportUtils.ts:2991early-returnsfalsewhentransactions.length === 0.hasSettledZeroReimbursableSpend()atReportUtils.ts:5463-5464requiresexpenses.length > 0, thus evaluating tofalse.
- Both checks fail, causing
isPayOptional()to evaluate tofalse. Therefore,!isPayOptional(...)evaluates totrue, mistakenly including the report in the Pay bucket despite its report-level summary fields already confirming zero reimbursable spend (reimbursableTotal === 0andnonReimbursableTotal !== 0).
What changes do you think we should make in order to solve the problem?
In src/libs/ReportUtils.ts, enhance isPayOptional() to evaluate report-level spend totals as a fallback when no transactions are currently loaded for that report:
diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index dd9296ea..4b210871 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -5468,6 +5468,18 @@ function hasSettledZeroReimbursableSpend(spendBreakdown: SpendBreakdown, report:
* Whether paying the report is optional because nothing is owed on it: every expense is non-reimbursable, or its reimbursable spend is settled at $0.
* These reports can still be marked as paid from the report, but aren't surfaced as something to pay (LHN badge, Search row action, Pay to-do).
*/
+function hasOnlyNonReimbursableTotals(report: OnyxInputOrEntry<Report>): boolean {
+ if (!isExpenseReport(report)) {
+ return false;
+ }
+ const isTotalLoaded = report?.total !== undefined || report?.reimbursableTotal !== undefined;
+ if (!isTotalLoaded || isReportTotalPending(report)) {
+ return false;
+ }
+ const spendBreakdown = getMoneyRequestSpendBreakdown(report);
+ return spendBreakdown.reimbursableSpend === 0 && Math.abs(spendBreakdown.nonReimbursableSpend) > 0;
+}
+
function isPayOptional(report: OnyxInputOrEntry<Report>, transactionsParam?: Transaction[]): boolean {
+ const transactions = resolveReportTransactions(report?.reportID, transactionsParam).filter((transaction) => !isTransactionPendingDelete(transaction));
+ if (transactions.length === 0) {
+ return hasOnlyNonReimbursableTotals(report);
+ }
return hasOnlyNonReimbursableTransactions(report?.reportID, transactionsParam) || hasSettledZeroReimbursableSpend(getMoneyRequestSpendBreakdown(report), report, transactionsParam);
}
This preserves the fail-closed behavior of hasSettledZeroReimbursableSpend whenever transactions are actually loaded (e.g., in-flight scanning receipts), while accurately classifying unloaded approved reports whose server-calculated totals indicate only non-reimbursable expenses exist. Furthermore, this simultaneously protects SearchUIUtils.ts and the LHN Pay badge (ReportUtils.ts:3555).
What alternative solutions did you explore? (Optional)
Gating solely on areTransactionsLoaded from TodoBucketContext:
While TodoBucketContext includes areTransactionsLoaded, that flag indicates global hydration of the transaction collection, not whether transactions for this specific report have been fetched from the server. An unloaded report will have zero per-report transactions even when the global collection has hydrated. Therefore, checking transactions.length === 0 in combination with report-level totals provides the robust, per-report source of truth across all consumers (TodosUtils, SearchUIUtils, and LHN badges).
What automated tests can you add to prevent this from re-occurring?
- In
tests/unit/ReportUtilsTest.ts:- Add a unit test asserting
isPayOptional()returnstruefor an approved expense report withreimbursableTotal: 0,nonReimbursableTotal: -5000, andtotal: -5000when no transactions are provided/loaded. - Add a unit test asserting
isPayOptional()returnsfalsewhenreimbursableTotal > 0or whenpendingFields.totalis set. - Add a unit test verifying
isPayOptional()continues to evaluate loaded transactions and properly fail-closed for unsettled/scanning expenses.
- Add a unit test asserting
- In
tests/unit/TodosUtilsTest.ts:- Verify that an approved report containing only non-reimbursable totals is excluded from
reportsToPayeven when its transaction objects are not yet loaded in Onyx.
- Verify that an approved report containing only non-reimbursable totals is excluded from
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f7d7991785f2ee01
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
Approved reports containing strictly non-reimbursable expenses incorrectly appear in the "Ready to pay" to-do list when their transactions have not yet been loaded into Onyx. Once a user opens the report and its transactions load, isPayOptional() evaluates to true, causing the report to disappear from "Ready to pay" and decrementing the count by one.
What is the root cause of that problem?
In src/libs/ReportUtils.ts, isPayOptional() relies on two helper functions: hasOnlyNonReimbursableTransactions(reportTransactions) and hasSettledZeroReimbursableSpend(report, reportTransactions).
When a report's transactions have not been fetched from the server into Onyx, reportTransactions is empty ([] or undefined):
hasOnlyNonReimbursableTransactions()returnsfalsewhentransactionsis empty (src/libs/ReportUtils.ts:2997-3001).hasSettledZeroReimbursableSpend()passes report-level checks but explicitly requiresexpenses.length > 0(src/libs/ReportUtils.ts:5500-5501).
Consequently, isPayOptional() returns false, and TodosUtils.ts:164 includes the unloaded report in the reportsToPay bucket despite its report object already having reimbursableTotal: 0 and nonReimbursableTotal equal to total.
What changes do you think we should make in order to solve the problem?
In src/libs/ReportUtils.ts, update isPayOptional() so that when reportTransactions is empty or undefined, it uses the report's top-level summary totals (reimbursableTotal and nonReimbursableTotal / total) to determine if the report consists solely of non-reimbursable expenses.
/// src/libs/ReportUtils.ts
function isPayOptional(report: OnyxEntry<Report>, reportTransactions?: Transaction[]): boolean {
if (!report) {
return false;
}
const hasLoadedTransactions = !!reportTransactions && reportTransactions.length > 0;
if (!hasLoadedTransactions) {
const hasZeroReimbursable = report.reimbursableTotal === 0;
const hasNonReimbursableSpend = (report.nonReimbursableTotal ?? 0) > 0 || (report.total ?? 0) > 0;
if (hasZeroReimbursable && hasNonReimbursableSpend && !isReportTotalPending(report)) {
return true;
}
}
return hasOnlyNonReimbursableTransactions(reportTransactions) || hasSettledZeroReimbursableSpend(report, reportTransactions);
}
What alternative solutions did you explore? (Optional)
-
Gating on
areTransactionsLoadedfromTodoBucketContext(Issue description suggestion):areTransactionsLoadedonly indicates that the initial Onyx transactions collection hydration has completed. Since individual report transactions are fetched on-demand when reports are opened,areTransactionsLoadedwill betrueeven when transactions for a specific un-opened report are not in Onyx. This leaves the bug active for unloaded reports. -
MelvinBot Proposal Flaws: MelvinBot proposed introducing a separate
hasOnlyNonReimbursableTotalhelper callinggetMoneyRequestSpendBreakdown(report).getMoneyRequestSpendBreakdownintroduces redundant recalculations and object creations whenreport.reimbursableTotalandreport.nonReimbursableTotal/report.totalare already normalized properties on the report object itself. Direct field checks insideisPayOptionalmaintain surgical minimalism (KISS principle) without extra function overhead.
What automated tests can you add to prevent this from re-occurring?
Add unit tests in tests/unit/ReportUtilsTest.ts:
describe('isPayOptional', () => {
it('returns true for an approved report with reimbursableTotal 0 and positive total when reportTransactions is empty', () => {
const report = {
reportID: '1',
statusNum: CONST.REPORT.STATUS_NUM.APPROVED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
reimbursableTotal: 0,
nonReimbursableTotal: 1000,
total: 1000,
} as Report;
expect(ReportUtils.isPayOptional(report, [])).toBe(true);
expect(ReportUtils.isPayOptional(report, undefined)).toBe(true);
});
it('returns false for an approved report when reimbursableTotal is greater than 0 and reportTransactions is empty', () => {
const report = {
reportID: '2',
statusNum: CONST.REPORT.STATUS_NUM.APPROVED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
reimbursableTotal: 500,
total: 500,
} as Report;
expect(ReportUtils.isPayOptional(report, [])).toBe(false);
});
});
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@jayeshmangwani is @MelvinBot's proposal good here?
@jayeshmangwani @joekaufmanexpensify Friendly bump on this! My proposal above (submitted earlier at #6506284978) accurately identifies the root cause and provides the clean fix. Ready to begin implementation as soon as assigned on Upwork!
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~016c1aa34b51059d42
Proposal
Please re-state the problem that we are trying to solve in this issue.
Approved expense reports that contain solely non-reimbursable expenses (e.g. corporate/company card transactions) incorrectly appear in the Ready to pay ("Pay") to-do bucket and LHN action list when their individual transactions have not yet been loaded into Onyx in the active session. When the workspace admin opens one of these reports, its transactions load, causing the report to disappear from "Ready to pay" and decrementing the bucket count by one.
What is the root cause of that problem?
In src/libs/TodosUtils.ts (line 164), the CONST.SEARCH.SEARCH_KEYS.PAY bucket condition filters out pay-optional reports via:
!isPayOptional(report, reportTransactions)
However, isPayOptional() in src/libs/ReportUtils.ts strictly relies on loaded transactions:
hasOnlyNonReimbursableTransactions()(ReportUtils.ts:2997–3001):
When transactions are not loaded,if (!transactions || transactions.length === 0) { return false; } return transactions.every((transaction) => !getReimbursable(transaction));transactionsis empty, so it returnsfalse.hasSettledZeroReimbursableSpend()(ReportUtils.ts:5463–5464):
Even though the report-level totals (const expenses = resolveReportTransactions(report?.reportID, transactionsParam).filter((transaction) => !isTransactionPendingDelete(transaction)); return expenses.length > 0 && !expenses.some((transaction) => isExpenseValueUnsettled(transaction, report ?? undefined, isScanningTransaction));reimbursableTotal === 0andtotal !== 0) are settled, this check explicitly requiresexpenses.length > 0, which evaluates tofalsewhen transactions are not loaded.
As a result, an approved non-reimbursable-only report whose transactions are not loaded is treated as payable (isPayOptional === false), placing it into the "Ready to pay" to-do bucket until the report is clicked.
What changes do you think we should make in order to solve the problem?
We should update isPayOptional() in src/libs/ReportUtils.ts to inspect the report-level summary totals when individual transactions have not been loaded or when reportTransactions is empty:
-
In
src/libs/ReportUtils.ts(isPayOptional): Add an optionalareTransactionsLoaded?: booleanparameter (or evaluate report totals whentransactionsis empty):function isPayOptional(report: OnyxInputOrEntry<Report>, transactionsParam?: Transaction[], areTransactionsLoaded?: boolean): boolean { const spendBreakdown = getMoneyRequestSpendBreakdown(report); const isTotalLoaded = report?.total !== undefined || report?.reimbursableTotal !== undefined; // If transactions are not loaded yet, use reliable report-level totals: // When reimbursable spend is settled at 0 and there is settled non-reimbursable spend, paying is optional. if (!areTransactionsLoaded && isTotalLoaded && !isReportTotalPending(report)) { if (spendBreakdown.reimbursableSpend === 0 && spendBreakdown.nonReimbursableSpend !== 0) { return true; } } return hasOnlyNonReimbursableTransactions(report?.reportID, transactionsParam) || hasSettledZeroReimbursableSpend(spendBreakdown, report, transactionsParam); } -
In
src/libs/TodosUtils.ts(line 164): PassareTransactionsLoadedfrom the already-availableTodoBucketContext(TodosUtils.ts:104):case CONST.SEARCH.SEARCH_KEYS.PAY: return ( isPrimaryPayAction({ ... }) && !isPayOptional(report, reportTransactions, areTransactionsLoaded) && (!allExpensesHeld || currentUserPlacedHold) );
This preserves the fail-closed protection for pending scanning receipts while allowing TodosUtils to correctly exclude approved non-reimbursable reports before their transaction sub-collections hydrate.
What alternative solutions did you explore? (Optional)
We could modify hasSettledZeroReimbursableSpend directly to bypass expenses.length > 0 when report?.transactionCount > 0, but passing areTransactionsLoaded from TodosUtils cleanly distinguishes "transactions not loaded into memory" from "report has zero expenses".
Tests
- Log in as a workspace admin with approved expense reports containing only non-reimbursable (company card) expenses.
- Refresh the browser / restart the app so transaction caches are cold.
- Navigate to the Spend page / check the LHN Ready to pay count.
- Verify that non-reimbursable-only reports do not appear under Ready to pay and do not increment the bucket count.
- Open one of the non-reimbursable reports, let its transactions load, and navigate back.
- Verify that the bucket count remains unchanged and the report remains excluded from Ready to pay.
- Verify that normal reimbursable approved reports still display in Ready to pay as expected.
- [x] Verify that no errors appear in the JS console
Offline tests
- Go offline.
- View the Ready to pay to-do list.
- Verify that non-reimbursable reports remain excluded offline when transactions are unloaded.
QA Steps
- As a workspace admin, ensure you have an approved report with only company card (non-reimbursable) expenses.
- Reload the page on web.
- Check the "Ready to pay" section on the Spend page.
- Confirm the approved non-reimbursable report is not listed in Ready to pay.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
17. @jayeshmangwani is @MelvinBot's proposal good here?
Yes, proposal looks good to move forward with.
@MelvinBot implement this
🤖 Draft PR created: https://github.com/Expensify/App/pull/105618 Please mark it as "Ready for review" or ask me to do that for you when it is ready for review.
When a report's transactions aren't loaded yet, isPayOptional() now uses the report's totals. Non-reimbursable-only reports stay out of Ready to pay before you open them. When transactions are loaded, the existing checks run unchanged.
The new unit tests pass, along with the related suites, typecheck, lint, and spell check. I didn't run the full Jest suite or test in the UI. The human co-author still needs to fill in the Tests and QA sections.
@jayeshmangwani can we get this to review soon?
26. @jayeshmangwani can we get this to review soon?
sorry for the delay. I’m working on it now. The only blocker is that I can’t reproduce the issue on staging, so I’m trying to find a way to reproduce it before confirming the fix.
@MelvinBot please check comments on PR