[$175] Add a More menu option to switch single-expense reports between expense view and table view
Problem
When a report has only one expense, we open it in the single-expense view. When it has more than one, we open it in the table view. Admins and approvers have told us the switch between these two layouts is confusing:
- Each time they open a report, they stop to work out which layout they're looking at and where things are.
- Some approvers find it easier to review in the table view, where expense-level fields appear as table columns.
- Users also mix up whether they're looking at an expense or a report.
Proposal
On single-expense reports, add an option to the More menu that switches the layout:
- In the single-expense view, the option says Switch to table view.
- In the table view, the option says Switch to expense view.
The option shows only on reports with one expense. Reports with more than one expense keep opening in the table view.
When a user picks an option, we save it as their default. Every single-expense report they open after that uses the view they chose, until they switch back.
This setting applies only to the user who picks it. It isn't a workspace setting.
Please refer to this POC build here to see the feature in action: https://100966.pr-testing.expensify.com/
Screenshots / Mockups
Here's a proof of concept for how this should look when viewing a single-expense expense report:
https://github.com/user-attachments/assets/641a396d-a5bc-42a3-baf8-9914448cbc15
Next steps
- Confirm the final copy and where the option goes in the More menu.
- Save the selection on the user's account so it applies on every device.
- Respect the saved view everywhere a single-expense report opens (Reports tab, chats, search results, and links).
Reported in Slack.
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022106061195817943488
- Upwork Job ID: 2106061195817943488
- Last Price Increase: 2026-10-02
Issue Owner
Current Issue Owner: @daledah
Triggered auto assignment to Design team member for new feature review - @dannymcclain (NewFeature)
Triggered auto assignment to Contributor-plus team member for initial proposal review - @daledah (External)
Job added to Upwork: https://www.upwork.com/jobs/~022106061195817943488
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users find the automatic layout switching between single-expense view and table view disorienting when reviewing single-expense reports. They need a persistent option in the More menu to view single-expense reports in table view across all their devices.
What is the root cause of that problem?
- In
src/libs/MoneyRequestReportUtils.ts,shouldDisplayReportTableView(report, transactions)evaluates!isReportTransactionThread(report) && !isSingleTransactionReport(report, transactions), forcing single-transaction reports into the single-expense view regardless of user preference. - There is no user-level Name-Value Pair (NVP) to persist this display preference across devices (
ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW). MoneyReportHeaderSecondaryActions.tsxlacks a contextual toggle item for single-transaction reports.
What changes do you think we should make in order to solve the problem?
-
User Preference Storage (
ReportLayout.ts&ONYXKEYS.ts):- Add
NVP_SINGLE_EXPENSE_TABLE_VIEW: 'nvp_expensify_singleExpenseTableView'insrc/ONYXKEYS.ts. - In
src/libs/actions/ReportLayout.ts, implementsetSingleExpenseTableView(shouldUseTableView: boolean, previousValue?: boolean)using the standardAPI.write(WRITE_COMMANDS.SET_NAME_VALUE_PAIRS, ...)with optimistic and failure rollback data.
- Add
-
More Menu Toggle (
MoneyReportHeaderSecondaryActions.tsx):- Subscribe to
ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW. - When
isSingleTransactionReport(moneyRequestReport, nonPendingDeleteTransactions)is true, insert a toggle action:- Label:
shouldUseTableView ? translate('reportLayout.viewAsSingleExpense') : translate('reportLayout.viewAsTable') - Icon:
shouldUseTableView ? Expensicons.Receipt : Expensicons.Table onSelected: CallsetSingleExpenseTableView(!shouldUseTableView, shouldUseTableView).
- Label:
- Subscribe to
-
Centralized Layout Resolution (
src/libs/MoneyRequestReportUtils.ts):- Update
shouldDisplayReportTableViewto accept ashouldUseTableViewForSingleExpensepreference and respect it for single-transaction reports (while still returning false for transaction threads). - Pass the preference through the main entry points:
MoneyRequestReportView.tsx,ReportActions.tsx, search views, and related RHP paths. - Suppress the wide receipt panel (
WideRHPReceiptPanel.tsx) when the single-expense table view preference is enabled.
- Update
-
Navigation Edge Case (
OneTransactionThreadRedirectHandler.tsx):MoneyRequestReportPreviewcan navigate usingchildReportID, which may represent the transaction thread rather than the parent report.- The redirect bypass must be scoped carefully so that enabling table view on the parent single-expense report does not break legitimate transaction-thread deep links or navigation flows.
-
Localization & Unit Tests:
- Add keys for
reportLayout.viewAsTableandreportLayout.viewAsSingleExpense(English source + existing translation process). - Add unit tests for the preference action, the updated layout resolver, menu visibility, and the redirect behavior.
- Add keys for
What alternative solutions did you explore? (Optional)
- Creating a dedicated backend command: Unnecessary β Expensify standardizes user preferences via
SET_NAME_VALUE_PAIRS. - Client-only local storage: Rejected because the setting must persist and sync across devices.
π£ @mohamad-shafeez! π£ 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>
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ede4d9cba5c66ae0
β 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.
When an expense report holds only one transaction, Expensify defaults to the combined single-expense view. When it contains two or more, it renders the multi-expense table view. Admins and approvers frequently find toggling between these two views disorienting and need an option to view single-expense reports in the table layout, with their selection persisted across sessions as a user preference.
What is the root cause of that problem?
- Hardcoded View Resolution:
In
src/libs/MoneyRequestReportUtils.ts,shouldDisplayReportTableView(report, transactions)evaluates!isReportTransactionThread(report) && !isSingleTransactionReport(report, transactions). It strictly forces single-expense reports into the single-expense view regardless of user preference. - Missing User NVP Preference:
There is no user-level Name-Value Pair (NVP) tracking whether single-expense reports should render as a table view (
ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW). - Missing More Menu Action:
MoneyReportHeaderSecondaryActions.tsxlacks a contextual toggle item to let the user switch betweenView as tableandView as single expenseon single-transaction reports.
What changes do you think we should make in order to solve the problem?
1. Add NVP Key and API Action (ReportLayout.ts & ONYXKEYS.ts)
- In
src/ONYXKEYS.ts: AddNVP_SINGLE_EXPENSE_TABLE_VIEW: 'nvp_expensify_singleExpenseTableView'. - In
src/libs/actions/ReportLayout.ts: CreatesetSingleExpenseTableView(shouldUseTableView: boolean, previousValue?: boolean):function setSingleExpenseTableView(shouldUseTableView: boolean, previousValue?: boolean) { const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW>> = [ { onyxMethod: Onyx.METHOD.SET, key: ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW, value: shouldUseTableView, }, ]; const failureData: Array<OnyxUpdate<typeof ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW>> = [ { onyxMethod: Onyx.METHOD.SET, key: ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW, value: previousValue ?? false, }, ]; const parameters: SetNameValuePairsParams = { [`nameValuePairs[expensify_singleExpenseTableView]`]: shouldUseTableView ? 'true' : '', }; API.write(WRITE_COMMANDS.SET_NAME_VALUE_PAIRS, parameters, {optimisticData, failureData}); }
2. Update Secondary Actions Menu (MoneyReportHeaderSecondaryActions.tsx)
- Subscribe to
useOnyx(ONYXKEYS.NVP_SINGLE_EXPENSE_TABLE_VIEW). - When
isSingleTransactionReport(moneyRequestReport, nonPendingDeleteTransactions)is true: InsertCONST.REPORT.SECONDARY_ACTIONS.TOGGLE_TABLE_VIEWinto the More menu right beforeVIEW_DETAILS:- Label:
shouldUseTableView ? translate('reportLayout.viewAsSingleExpense') : translate('reportLayout.viewAsTable') - Icon:
shouldUseTableView ? Expensicons.Receipt : Expensicons.Table onSelected: InvokesetSingleExpenseTableView(!shouldUseTableView, shouldUseTableView).
- Label:
3. Update Table View Resolution (MoneyRequestReportUtils.ts)
- Update
shouldDisplayReportTableView:function shouldDisplayReportTableView(report: OnyxEntry<Report>, transactions: Transaction[], shouldUseTableViewForSingleExpense = false) { if (isReportTransactionThread(report)) { return false; } return shouldUseTableViewForSingleExpense || !isSingleTransactionReport(report, transactions); } - Pass
shouldUseTableViewForSingleExpenseacross all call sites:src/components/MoneyRequestReportView/MoneyRequestReportView.tsxsrc/pages/inbox/ReportActions.tsx
4. Adjust Layout Panels & Navigation Callbacks
WideRHPReceiptPanel.tsx&MoneyRequestReportView.tsx: The side-by-side receipt panel belongs to the single-expense view; suppressshouldShowWideRHPReceiptwhenshouldUseTableViewForSingleExpenseis enabled.SearchMoneyRequestReportPage.tsx&Search/index.tsx: Widen the RHP layout tosuper-widewhenshouldUseTableViewForSingleExpense && visibleTransactions.length === 1so the single-row table receives the identical layout width as a multi-expense report.OneTransactionThreadRedirectHandler.tsx: Prevent auto-redirecting to the parent report whenshouldUseTableViewForSingleExpenseis enabled, allowing clicking and navigating into the transaction thread row from the table view.
5. Localization (src/languages/*.ts)
Add keys across all locale files:
reportLayout.viewAsTable:'View as table'reportLayout.viewAsSingleExpense:'View as single expense'
6. Unit Tests
- In
tests/unit/MoneyRequestReportUtilsTest.ts: VerifyshouldDisplayReportTableViewreturnstruefor a single-transaction report whenshouldUseTableViewForSingleExpense = true, andfalsewhenfalse. - In
tests/unit/ReportLayoutTest.ts: VerifysetSingleExpenseTableViewproperly formatsnameValuePairs[expensify_singleExpenseTableView]payload and applies optimistic Onyx updates.
What alternative solutions did you explore? (Optional)
- Using a dedicated API command (e.g.
SetPreferredSingleExpenseView): Redundant because Expensify standardizes account-level user preferences viaSetNameValuePairsandexpensify_*NVPs. - Purely local client-side storage: Would fail the requirement to persist and sync preferences across user devices.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0146a4de0ca9fff602
β Contributor details stored successfully. Thank you for contributing to Expensify!
When an expense report contains a single transaction, Expensify automatically renders it in the single-expense view, whereas reports with multiple transactions render in the table view. Admins and approvers who prefer a consistent table layout for all reports need the ability to toggle single-expense reports into the table view (and back to the expense view) via the More menu, with their selection persisted as their personal default across all single-expense reports. Add the exact wording specified in the issue requirements:Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
src/libs/MoneyRequestReportUtils.ts, shouldDisplayReportTableView() hardcodes single-transaction reports to the single-expense view (!isSingleTransactionReport(report, transactions)), providing no mechanism to honor a user's layout preference.MoneyReportHeaderSecondaryActions.tsx) does not include an option to switch between table view and expense view when viewing a single-expense report.What changes do you think we should make in order to solve the problem?
1. Define Preference Key and Sync Action (
ONYXKEYS.ts & src/libs/actions/ReportLayout.ts)
src/ONYXKEYS.ts:
Add NVP_SINGLE_EXPENSE_LAYOUT_PREFERENCE: 'nvp_expensify_singleExpenseLayoutPreference'.src/CONST.ts:
REPORT: {
LAYOUT: {
TABLE: 'table',
EXPENSE: 'expense',
},
}
src/libs/actions/ReportLayout.ts:
Implement setSingleExpenseLayoutPreference(layout: 'table' | 'expense', previousLayout?: string):
Note on Backend Independence: Because function setSingleExpenseLayoutPreference(layout: 'table' | 'expense', previousLayout?: string) {
// 1. Optimistically update Onyx for immediate, persistent UI feedback across sessions
const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.NVP_SINGLE_EXPENSE_LAYOUT_PREFERENCE>> = [
{
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_SINGLE_EXPENSE_LAYOUT_PREFERENCE,
value: layout,
},
];
const failureData: Array<OnyxUpdate<typeof ONYXKEYS.NVP_SINGLE_EXPENSE_LAYOUT_PREFERENCE>> = [
{
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_SINGLE_EXPENSE_LAYOUT_PREFERENCE,
value: previousLayout ?? CONST.REPORT.LAYOUT.EXPENSE,
},
];
// 2. Dispatch SetNameValuePairs to sync preference to account backend
const parameters: SetNameValuePairsParams = {
nameValuePairs: JSON.stringify({
expensify_singleExpenseLayoutPreference: layout,
}),
};
API.write(WRITE_COMMANDS.SET_NAME_VALUE_PAIRS, parameters, {optimisticData, failureData});
}
Onyx.set persists the key locally in storage, the preference survives app restarts, navigation transitions, and device reloads immediately. If backend deployment for this specific NVP key is staged or delayed, client persistence remains 100% resilient and functional without blocking.2. Update More Menu in Report Header (
MoneyReportHeaderSecondaryActions.tsx)
ONYXKEYS.NVP_SINGLE_EXPENSE_LAYOUT_PREFERENCE.isSingleTransactionReport(report, transactions) is true:
Conditionally add a menu option to the secondary actions list:
layout !== 'table'):
translate('reportLayout.switchToTableView') ("Switch to table view")Expensicons.TablesetSingleExpenseLayoutPreference(CONST.REPORT.LAYOUT.TABLE, layout)layout === 'table'):
translate('reportLayout.switchToExpenseView') ("Switch to expense view")Expensicons.ReceiptsetSingleExpenseLayoutPreference(CONST.REPORT.LAYOUT.EXPENSE, layout)3. Update Table View Resolution (
MoneyRequestReportUtils.ts)
shouldDisplayReportTableView(report, transactions, singleExpenseLayoutPreference):
function shouldDisplayReportTableView(
report: OnyxEntry<Report>,
transactions: Transaction[],
singleExpenseLayoutPreference?: string
): boolean {
if (isReportTransactionThread(report)) {
return false;
}
const isSingle = isSingleTransactionReport(report, transactions);
if (isSingle) {
return singleExpenseLayoutPreference === CONST.REPORT.LAYOUT.TABLE;
}
return true;
}
singleExpenseLayoutPreference from useOnyx(ONYXKEYS.NVP_SINGLE_EXPENSE_LAYOUT_PREFERENCE) at MoneyRequestReportView.tsx and ReportActions.tsx.shouldShowWideRHPReceipt in WideRHPReceiptPanel.tsx to remain hidden when a single-expense report is rendered in table view, maintaining consistency with standard table layout.4. Localization (
src/languages/en.ts and es.ts)
reportLayout.switchToTableView: "Switch to table view"reportLayout.switchToExpenseView: "Switch to expense view"5. Automated Unit Tests
tests/unit/MoneyRequestReportUtilsTest.ts:
true when singleExpenseLayoutPreference === 'table'.false when singleExpenseLayoutPreference === 'expense' or undefined.true regardless of preference.tests/unit/ReportLayoutTest.ts verifying optimistic Onyx updates, storage resilience, and API payload formatting.What alternative solutions did you explore? (Optional)
useState): Rejected because user preferences must persist across navigation and reload rather than resetting whenever the report view unmounts.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0170d6b02e9440e604
β Contributor details stored successfully. Thank you for contributing to Expensify!
on my list today
@MelvinBot please post a proposal to this issue
Proposal
Please re-state the problem that we are trying to solve in this issue.
A report with one expense always opens in the single-expense view, and a report with more expenses opens in the table view. Users can't choose the table view for single-expense reports, and there's no saved preference for it.
What is the root cause of that problem?
The layout is hard-coded. shouldDisplayReportTableView returns false for every single-transaction report. No user preference exists to change that.
Several other places also assume "one expense = single-expense view":
- The redirect handler sends one-transaction threads back to the parent report.
- The RHP width logic and the side-by-side receipt panel.
- The composer, which posts comments to the transaction thread.
What changes do you think we should make in order to solve the problem?
- Save the preference. Add an account NVP,
nvp_expensify_singleExpenseReportView('expense' | 'table', defaultexpense). AddsetSingleExpenseReportViewto the existingReportLayout.tsactions. LikesetReportLayout, it callsSET_NAME_VALUE_PAIRSwith optimistic and failure data. Add the key toOnyxValuesMappingand to a bucket inExportOnyxState/masking.ts. - Add the More menu option. Both views use
MoneyReportHeader, so add aTOGGLE_SINGLE_EXPENSE_VIEWsecondary action ingetSecondaryReportActions, just before View details. Show it only whenisSingleTransactionReportis true. Label it Switch to table view or Switch to expense view, based on the saved value. Add the handler inMoneyReportHeaderSecondaryActions.tsxand the entry inPopoverMenuSections.ts. - Use the preference in one place. Add a
useSingleExpenseReportView()hook. Pass its result toshouldDisplayReportTableViewfrom all three callers (ReportActions,MoneyRequestReportView,WideRHPReceiptPanel). Transaction threads keep returningfalse. - Match the rest of the UI to the chosen view. When the table view is on for a single-expense report:
- Hide the side-by-side receipt and use the super-wide RHP, as for multi-expense reports. Keep empty reports as they are.
- Skip the one-transaction redirect, so tapping the table row opens the expense. Wait until the NVP has loaded, so deep links don't redirect too early.
- Post composer comments to the report, not the hidden thread. This follows the existing
isSentMoneyReportrule, so comments don't vanish from the table view.
- Translations and tests. Add the two strings to every language file. Add tests for the action, the layout helper, the menu visibility, and the redirect handler. Update that handler's
useOnyxmock.
Backend dependency: the new NVP name must be returned by the backend before the setting syncs across devices. An internal engineer needs to confirm this.
What alternative solutions did you explore? (Optional)
Save the preference only on the device. This is simpler, but it fails the requirement to apply the setting on every device.
Notes on the POC
Add a More menu toggle to view a single-expense report as a table has the same basic approach. This proposal also covers these gaps:
- Composer comments on a single-expense report in table view go to the hidden thread, so the user never sees them.
- The new NVP isn't in
masking.ts(ExportOnyxStateTestfails), and the redirect handler tests break because of theuseOnyxmock. - The redirect reads the NVP before it loads, so a cold deep link can redirect too early.
- Search marks empty reports super-wide.
- The action is spliced into the component instead of
getSecondaryReportActions.
Open product question: in table view, should a single-expense row in Search open the one-row report table (current behavior) or the expense itself?
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/102910#issuecomment-5992019522) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Technical Follow-up / Refinement
Took another pass through the current codebase and the POC, and wanted to tighten a few implementation details on top of my original proposal:
-
Copy Alignment: Align the menu action labels exactly with the issue spec:
"Switch to table view"and"Switch to expense view". -
NVP State Structure: Storing the layout preference as an explicit string (
'expense' | 'table') rather than a boolean makes the state explicit and cleaner to extend. The new NVP should also be wired through the relevant Onyx mapping/export state handling so the normal state validation and masking tests remain green. -
Menu Construction: Rather than injecting the toggle purely inside
MoneyReportHeaderSecondaryActions.tsx, wire the action through the existinggetSecondaryReportActions/PopoverMenuSectionsflow so it follows the standard report-action lifecycle. It should only be available for a single-expense report, using the same transaction filtering as the existing single-transaction checks. -
Hydration Race Condition: In
OneTransactionThreadRedirectHandler.tsx, the redirect logic should wait for the NVP to be hydrated before evaluating the navigation decision on a cold deep link. This avoids applying an assumed default before the saved preference is available. -
Composer Routing: When a single-expense report is rendered in table view, comments should route to the parent report rather than only to the transaction thread, so the composer continues to target the content the user is actually viewing.
-
Layout & Panels: The RHP/receipt behavior should remain consistent with the selected layout, including suppressing the receipt panel where appropriate and using the appropriate wide/super-wide layout for a single-row table. Empty reports and pending-delete transactions should retain their existing behavior.
The core architecture from my original proposal remains the same; these refinements are mainly to make the implementation robust across deep links, composer targets, RHP behavior, and the relevant test paths.
I added a proof of concept video to the top comment of this GH issue.
@MelvinBot implement this
π€ Draft PR created: Add a More menu option to switch single-expense reports between expense view and table view Please mark it as "Ready for review" when it is ready for review.
It follows the approved proposal:
- Saves the choice in a new account NVP,
nvp_expensify_singleExpenseReportView. - Adds Switch to table view / Switch to expense view to the More menu on single-expense reports only.
- In table view, the receipt panel is hidden, the RHP is super-wide, tapping the row opens the expense, and comments post to the report.
Typecheck, lint, and the related Jest suites pass. I couldn't run a browser check because the test session never rendered, so manual testing is still needed.
Backend dependency: the backend must return nvp_expensify_singleExpenseReportView for the setting to sync across devices. An internal engineer needs to confirm this.
view run Β· no recording available
@sakluger This PR is ready for review. Since I don't have permission to mark it as ready (and MelvinBot wasn't able to do it either). Could you mark it as ready and take a look? TIA!
Deploy Blocker https://github.com/Expensify/App/issues/103387 was identified to be related to the PR https://github.com/Expensify/App/pull/103121 that attempted to fix this issue.