[$175] [Exploratory] Invoice-Invoice received is not shown on searching type: invoice in spend section.
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: V9.5.20-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/80268785/folder/13176671/130662267/1903875810?sort=%2Bname Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Redmi note 10s android 13 App Component: User Settings
Action Performed:
- Launch app
- Send invoice from user A to user B
- Open user B and search type: invoice
- Note invoice received is not shown
- Go to LHN and note invoice received is shown
Expected Result:
Invoice received must be shown on searching type: invoice in spend section.
Actual Result:
Invoice received is not shown on searching type: invoice in spend section.
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/66675614-cffe-42c1-8a56-06df9cbfbced
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7295064
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022117413470485555830
- Upwork Job ID: 2117413470485555830
- Last Price Increase: 2026-11-03
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/b9bd555a460c868286579c58ae56beec1875b9830fa4774796f6d1de7f4773f9
Issue Analysis
Root Cause: This appears to be a backend/internal issue. A separate internal investigation is needed.
The App sends type:invoice to the Search API with no extra filters, and it shows every invoice row the API returns. So when user B, the invoice receiver, gets no rows, the Search response most likely leaves out invoices they received. The LHN still shows the invoice because it reads the report from Onyx, not from Search.
Recommended Fix: You need to change the backend Search command, not the App. Escalate this to an internal engineer who can work on the backend.
Investigation details
No default invoice filter in the query
- The parser's only defaults are
type,sortBy,sortOrderandview. It adds nofrom:,to:,policyID:or status filter:src/libs/SearchParser/searchParser.peggy:65-70. search()sends the parsed query asjsonQueryand adds no policy or membership scoping:src/libs/actions/Search.ts:1415-1427.
No client-side filter drops received invoices
getTransactionsSectionshides a row only if it has notransactionID. The status filter applies only totype:expense:src/libs/SearchUIUtils.ts:1961-1968.- A missing sender workspace in user B's data doesn't hide the row. It only leaves
policyundefined:src/libs/SearchUIUtils.ts:1972. - The Invoice type option only controls whether the option appears, not which results come back:
src/libs/SearchUIUtils.ts:5659.
Not verified
- Production logs weren't available during this run. To confirm, check user B's
Searchrequest fortype:invoice:- If the response has no invoice report or transaction, the backend is the cause.
- If the response has them and they still don't show, check whether the transaction is missing a
transactionID.
Alternative considered: a recent App regression. The client code above has no invoice- or receiver-specific filtering, so a client change is unlikely to cause this.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (External)
Job added to Upwork: https://www.upwork.com/jobs/~022117413470485555830
@aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When User A sends an invoice from a workspace to User B (an individual user who does not own an invoice-enabled workspace), User B receives the invoice in their LHN chat, but when User B navigates to Spend (Search) and searches type: invoice (or opens the Type filter dropdown), the received invoice is not shown and "Nothing to show" is displayed.
What is the root cause of that problem?
There are three layers to this issue across the search parser, the Type filter option guard, and the optimistic/local search state for an invoice receiver:
-
searchParser.peggydoes not allow whitespace after:intype: invoice, turningtype: invoiceintotype:expense+ keyword"invoice"(src/libs/SearchParser/searchParser.peggy, lines 65–115): Notice the exact query in the issue title and reproduction steps:searching type: invoice in spend section(with a space after the colon).- For User A (who has
canSendInvoice(policies, currentUserLogin) === true), typingtype:in the Search router showsInvoicein the autocomplete dropdown (useAutocompleteSuggestions.ts), which insertstype:invoicewithout a space. - For User B (an individual receiver with
canSendInvoice === false), ifInvoiceis missing from theTypefilter / autocomplete or the user typestype: invoicewith a space after the colon,searchParser.peggyfails to matchfilterbecause the grammar rule requireskey ":" identifierwith no horizontal whitespace after":". - As a result,
type:is parsed as a bare word and"invoice"is parsed as a free-text keyword against the defaulttype: "expense", so the app sendstype:expensewith keyword"invoice"instead oftype:invoice!
- For User A (who has
-
hasInvoiceReports()insrc/libs/ReportUtils.ts(lines 14852–14855) only checksisInvoiceReport(report)and missesisInvoiceRoom(report)andchatReport.iouReportID: Insrc/libs/SearchUIUtils.ts(line 5702):const shouldHideInvoiceOption = !canSendInvoice(policies, currentUserLogin) && !hasInvoiceReports();And in
src/libs/ReportUtils.ts(lines 14852–14855):function hasInvoiceReports() { const reports = Object.values(deprecatedAllReports ?? {}); return reports.some((report) => isInvoiceReport(report)); }When User B receives an invoice notification via Pusher before opening the invoice room, Onyx has the
invoicechat room (chatType: CONST.REPORT.CHAT_TYPE.INVOICE, i.e.isInvoiceRoom(report)) withiouReportIDset, while the childtype: CONST.REPORT.TYPE.INVOICEreport object may not be loaded intoONYXKEYS.COLLECTION.REPORTyet. Consequently,hasInvoiceReports()returnsfalse, hiding theInvoiceoption inTypeSelector(src/components/Search/FilterComponents/TypeSelector.tsx, line 56). -
TypeSelector.tsxdoes not subscribe toONYXKEYS.COLLECTION.REPORT, sogetTypeOptionsuses a non-reactive call tohasInvoiceReports()(src/components/Search/FilterComponents/TypeSelector.tsx, lines 51–56):TypeSelectoronly subscribes toONYXKEYS.COLLECTION.POLICYandONYXKEYS.SESSION, so even when an invoice report arrives inONYXKEYS.COLLECTION.REPORT,TypeSelectordoes not re-evaluate rigorously viauseOnyx.
What changes do you think we should make in order to solve the problem?
-
In
src/libs/ReportUtils.ts(hasInvoiceReports, lines 14852–14855): Check bothisInvoiceReport(report)andisInvoiceRoom(report)so an individual user who has received an invoice in an invoice chat room is immediately recognized as having invoice reports:function hasInvoiceReports() { const reports = Object.values(deprecatedAllReports ?? {}); return reports.some((report) => isInvoiceReport(report) || (isInvoiceRoom(report) && !!report?.iouReportID)); } -
In
src/libs/SearchParser/searchParser.peggy(andsrc/libs/SearchParser/autocompleteParser.peggy) followed bynpm run build-parser: Allow optional horizontal whitespace ([ \t]*) immediately after the colon":"in filter rules (e.g.type: invoice) so that typingtype: invoicewith a space after the colon parses astype: "invoice"instead of falling back totype: "expense"with keyword"invoice". -
In
tests/unit/SearchParserTest.tsandtests/unit/SearchUIUtilsTest.ts: Add unit tests verifying that:parseSearchQuery('type: invoice')parsestypeasCONST.SEARCH.DATA_TYPES.INVOICEwith no leftover keyword filter.getTypeOptionsincludesCONST.SEARCH.DATA_TYPES.INVOICEfor a receiver who has an invoice room (chatType: CONST.REPORT.CHAT_TYPE.INVOICEwithiouReportID) even whencanSendInvoiceisfalse.
What alternative solutions did you explore?
We also checked whether getTransactionsSections in src/libs/SearchUIUtils.ts filters out received invoices on the client when type === CONST.SEARCH.DATA_TYPES.INVOICE; it does not. Allowing optional space after : in searchParser.peggy and checking isInvoiceRoom(report) in hasInvoiceReports() ensures both manual type: invoice queries and the Type filter selector work for individual invoice receivers.
📣 @pa-khan! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
Please re-state the problem that we are trying to solve in this issue.
When User A sends an invoice to User B ( receiver), User B sees the received invoice in the Left Hand Navigation (LHN), but when User B navigates to Spend and searches type:invoice, the received invoice does not appear in the search results.
What is the root cause of that problem?
This is caused by how the backend Search API scopes type:invoice queries, combined with no client-side optimistic search snapshot injection for the invoice receiver:
- In
src/libs/SearchParser/searchParser.peggy(lines 65–70) andsrc/libs/actions/Search.ts(lines 1415–1427), searchingtype:invoicein theSpendsection parses to{type: 'invoice', sortBy: 'date', sortOrder: 'desc', view: 'table'}and sends theSearchcommand to the backend withjsonQuery. - On the frontend,
getTransactionsSectionsinsrc/libs/SearchUIUtils.tsrenders every transaction returned incurrentSearchResults?.datawithout filtering out received invoices. - However, on the backend (
Auth/Web-Expensify),type:invoicesearches only return invoices belonging to workspace policies where the user is an admin/member (i.e., sent invoices managed under a workspace'sInvoicesfeature). For an individual recipient (User B) who received the invoice in a personal invoice receiver room (chatType: 'invoice'), the backendSearchquery fortype:invoiceomits received invoices (returningdata: {}), whereas the LHN displays the invoice chat becauseSidebarLinksDatareadsONYXKEYS.COLLECTION.REPORTdirectly from Onyx.
What changes do you think we should make in order to solve the problem?
This requires a backend change in the Search command handler (Web-Expensify / Auth):
- Update the backend
Searchquery fortype:invoice(CONST.SEARCH.DATA_Types.INVOICE) so that in addition to querying invoices on policies where the current user is an admin/member, it also includes invoice reports (type = 'invoice'/chatType = 'invoice') where the current user'saccountIDis the invoice receiver (managerID/ participant on the invoice room). - No frontend parser or table-rendering changes in
Expensify/Appare needed once the backend returns received invoice reports and transactions in theSearchsnapshot.
What alternative solutions did you explore? (Optional)
We checked whether Expensify/App could merge local ONYXKEYS.COLLECTION.REPORT invoice rooms into Search results on the client in src/libs/SearchUIUtils.ts, but Search snapshots are paginated and server-driven (currentSearchResults.data), so client-side injection would break pagination, sorting, and aggregations when the user has not opened every invoice report locally.
📣 @jeff-graham-ai! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
@aimane-chnaif this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@aimane-chnaif Still overdue 6 days?! Let's take care of this!
@aimane-chnaif Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
This issue has not been updated in over 14 days. @aimane-chnaif eroding to Weekly issue.