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
[$175] Allow the Per Diem import template to be downloaded before adding rates. #104175
Version Number: v9.5.9-4 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: No Issue reported by:@trjExpensify
Action Performed:
Go to a workspace
Enable Per Diem
Click "More"
Expected Result:
I should see the "Download CSV" option, just like I do after adding rates.
Actual Result:
I don't see the "Download CSV" option until I add rates.
Workaround:
Go to Classic where this download option is available prior to adding rates. We make it available prior to adding rates as an easy way to grab the expected import template with the right headers etc to follow.
Platforms:
Select the officially supported platforms where the issue was reproduced:
changed the title [-]Allow the Per Diem import template to be downloaded before adding rates.[/-][+][$175] Allow the Per Diem import template to be downloaded before adding rates.[/+]on Oct 15, 2026
The "Download CSV" item in the "More" menu is only added when the workspace has at least one visible per diem rate. In WorkspacePerDiemPage.tsx:239, the item is wrapped in if (hasVisibleSubRates). That flag is false until rates exist (line 180). So a new Per Diem setup shows only "Import spreadsheet."
What changes do you think we should make in order to solve the problem?
In secondaryActions in WorkspacePerDiemPage.tsx, change the condition for the "Download CSV" item from hasVisibleSubRates to hasVisibleSubRates || canWritePerDiem.
Admins who can import rates will always see "Download CSV," so they can grab the template with the correct headers.
Read-only members keep today's behavior. They see it only when rates exist, because an empty template is useless to someone who can't import.
No change is needed in downloadPerDiemCSV. It already calls ExportPerDiemCSV with only the policyID. The existing download-failure modal still handles errors.
To verify before merging: confirm that ExportPerDiemCSV returns a CSV with only the header row when the workspace has no rates. Classic offers this download before rates exist, which suggests the backend supports it. I couldn't confirm that from the App repo. If the backend returns an error instead, that fix is outside the App repo, and an internal engineer needs to handle it.
What alternative solutions did you explore? (Optional)
Always show "Download CSV." This is simpler, but read-only members would get an empty file with no way to use it.
Add a "Download template" button to the empty state next to "Import spreadsheet." This is more discoverable, but the issue asks for parity with the "More" menu. It also adds new copy that would need translations.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/104175) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
In a workspace with Per Diem enabled, clicking the "More" dropdown button before any per diem rates have been added does not display the "Download CSV" option, preventing users from downloading the import CSV template with the expected headers before importing rates.
When a user enables Per Diem on a new workspace and has not yet created or imported any rates, allSubRates is empty ([]), causing hasVisibleSubRates to evaluate to false. As a result, the Download CSV option is completely omitted from the secondaryActions array passed to the ButtonWithDropdownMenu ("More" button).
However, the backend command EXPORT_PER_DIEM_CSV called by downloadPerDiemCSV(policyID, ...) already handles empty rates by exporting the standard Per Diem CSV template with all required headers (Destination, Currency, Rate, Subrate name), which is the exact behavior used in Expensify Classic.
What changes do you think we should make in order to solve the problem?
1. Remove the hasVisibleSubRates guard for "Download CSV" in WorkspacePerDiemPage.tsx:
(Note: hasVisibleSubRates remains in WorkspacePerDiemPage.tsx as it is still utilized in lines 418 & 424 for conditionally placing subtitleContent in the table header versus page body).
What alternative solutions did you explore? (Optional)
Adding a secondary button in the empty state: In addition to the "More" dropdown, we could also explore adding a secondary "Download template" button inside emptyState.buttons when allSubRates is empty. However, keeping it in the "More" dropdown directly satisfies the issue requirements and provides consistency across workspaces with and without rates.
Guarding by canWritePerDiem: We could also consider if (canWritePerDiem) for Download CSV, but keeping it available to anyone who can access the Per Diem page (already restricted to admins via AccessOrNotFoundWrapper) matches the existing permissions of downloadPerDiemCSV.
Please re-state the problem that we are trying to solve in this issue.
When Per Diem is enabled in a workspace, the "Download CSV" option in the "More" menu is hidden until rates are added, preventing admins from downloading the import template.
What is the root cause of that problem?
In src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx:239, the "Download CSV" secondary action is guarded by hasVisibleSubRates:
When Per Diem is enabled without any rates yet created, hasVisibleSubRates evaluates to false. Consequently, the "Download CSV" option is omitted from the More menu. However, the backend export command (EXPORT_PER_DIEM_CSV) successfully generates PerDiem.csv containing the expected header columns and template structure even when no rates exist.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx, update the condition for adding the "Download CSV" menu item to hasVisibleSubRates || canWritePerDiem. This ensures that workspace admins who can configure Per Diem can download the CSV template prior to adding rates, matching Classic behavior:
--- a/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx+++ b/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx@@ -236,3 +236,3 @@
}
- if (hasVisibleSubRates) {+ if (hasVisibleSubRates || canWritePerDiem) {
menuItems.push({
What alternative solutions did you explore? (Optional)
Please re-state the problem that we are trying to solve in this issue.
The "Download CSV" option in the Per Diem "More" menu is hidden when no rates exist, preventing users from downloading the template format before importing rates.
What is the root cause of that problem?
In src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx line 239, the "Download CSV" option inside secondaryActions is wrapped in if (hasVisibleSubRates). Because hasVisibleSubRates evaluates to false when a workspace has no per diem rates defined yet (line 180), the "Download CSV" option is excluded from the "More" overflow menu. The menu omits it.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx:
In secondaryActions (lines 239-260), remove the if (hasVisibleSubRates) condition guarding the "Download CSV" item so that the option is always appended to menuItems.
In the useMemo dependency array for secondaryActions (line 269), remove hasVisibleSubRates because it is no longer consumed by the memoized callback.
downloadPerDiemCSV in src/libs/actions/Policy/PerDiem.ts requires no changes because it invokes fileDownload with WRITE_COMMANDS.EXPORT_PER_DIEM_CSV and policyID. The backend already supports exporting the standard Per Diem CSV header template when a workspace contains zero rates (as currently demonstrated in Classic Expensify).
What alternative solutions did you explore? (Optional)
I considered adding a dedicated "Download template" button inside emptyState (line 360) alongside the "Import spreadsheet" button. However, keeping "Download CSV" in the "More" overflow menu directly satisfies the reported requirement and maintains UX consistency with other workspace pages such as Members (WorkspaceMembersPage.tsx).
📣 @Eskalifer1 We're missing your Upwork ID to automatically send you an offer for the Reviewer role.
Once you apply to the Upwork job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Activity
melvin-bot commentedon Oct 15, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Eskalifer1 (
External)[-]Allow the Per Diem import template to be downloaded before adding rates.[/-][+][$175] Allow the Per Diem import template to be downloaded before adding rates.[/+]melvin-bot commentedon Oct 15, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022110877625981373807
trjExpensify commentedon Oct 15, 2026
@MelvinBot propose a solution to this.
MelvinBot commentedon Oct 15, 2026
Proposal
What is the root cause of that problem?
The "Download CSV" item in the "More" menu is only added when the workspace has at least one visible per diem rate. In
WorkspacePerDiemPage.tsx:239, the item is wrapped inif (hasVisibleSubRates). That flag is false until rates exist (line 180). So a new Per Diem setup shows only "Import spreadsheet."What changes do you think we should make in order to solve the problem?
In
secondaryActionsinWorkspacePerDiemPage.tsx, change the condition for the "Download CSV" item fromhasVisibleSubRatestohasVisibleSubRates || canWritePerDiem.No change is needed in
downloadPerDiemCSV. It already callsExportPerDiemCSVwith only thepolicyID. The existing download-failure modal still handles errors.To verify before merging: confirm that
ExportPerDiemCSVreturns a CSV with only the header row when the workspace has no rates. Classic offers this download before rates exist, which suggests the backend supports it. I couldn't confirm that from the App repo. If the backend returns an error instead, that fix is outside the App repo, and an internal engineer needs to handle it.What alternative solutions did you explore? (Optional)
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/104175)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
janiya2 commentedon Oct 15, 2026
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/janithad
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a workspace with Per Diem enabled, clicking the "More" dropdown button before any per diem rates have been added does not display the "Download CSV" option, preventing users from downloading the import CSV template with the expected headers before importing rates.
What is the root cause of that problem?
In
src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx:239-260, the "Download CSV" menu item insecondaryActionsis conditionally wrapped insideif (hasVisibleSubRates):Where
hasVisibleSubRatesis computed as:When a user enables Per Diem on a new workspace and has not yet created or imported any rates,
allSubRatesis empty ([]), causinghasVisibleSubRatesto evaluate tofalse. As a result, theDownload CSVoption is completely omitted from thesecondaryActionsarray passed to theButtonWithDropdownMenu("More" button).However, the backend command
EXPORT_PER_DIEM_CSVcalled bydownloadPerDiemCSV(policyID, ...)already handles empty rates by exporting the standard Per Diem CSV template with all required headers (Destination,Currency,Rate,Subrate name), which is the exact behavior used in Expensify Classic.What changes do you think we should make in order to solve the problem?
1. Remove the
hasVisibleSubRatesguard for "Download CSV" inWorkspacePerDiemPage.tsx:In
src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx:Remove the
if (hasVisibleSubRates)check soDownload CSVis always included in thesecondaryActionsmenu:(Note:
hasVisibleSubRatesremains inWorkspacePerDiemPage.tsxas it is still utilized in lines 418 & 424 for conditionally placingsubtitleContentin the table header versus page body).What alternative solutions did you explore? (Optional)
emptyState.buttonswhenallSubRatesis empty. However, keeping it in the "More" dropdown directly satisfies the issue requirements and provides consistency across workspaces with and without rates.canWritePerDiem: We could also considerif (canWritePerDiem)forDownload CSV, but keeping it available to anyone who can access the Per Diem page (already restricted to admins viaAccessOrNotFoundWrapper) matches the existing permissions ofdownloadPerDiemCSV.melvin-bot commentedon Oct 15, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
camesenin commentedon Oct 15, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When Per Diem is enabled in a workspace, the "Download CSV" option in the "More" menu is hidden until rates are added, preventing admins from downloading the import template.
What is the root cause of that problem?
In
src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx:239, the "Download CSV" secondary action is guarded byhasVisibleSubRates:When Per Diem is enabled without any rates yet created,
hasVisibleSubRatesevaluates tofalse. Consequently, the "Download CSV" option is omitted from the More menu. However, the backend export command (EXPORT_PER_DIEM_CSV) successfully generatesPerDiem.csvcontaining the expected header columns and template structure even when no rates exist.What changes do you think we should make in order to solve the problem?
In
src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx, update the condition for adding the "Download CSV" menu item tohasVisibleSubRates || canWritePerDiem. This ensures that workspace admins who can configure Per Diem can download the CSV template prior to adding rates, matching Classic behavior:What alternative solutions did you explore? (Optional)
None.
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~0170d6b02e9440e604
melvin-bot commentedon Oct 15, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
taieddie commentedon Oct 16, 2026
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01e51b3f9ff738cf94
Proposal
Please re-state the problem that we are trying to solve in this issue.
The "Download CSV" option in the Per Diem "More" menu is hidden when no rates exist, preventing users from downloading the template format before importing rates.
What is the root cause of that problem?
In
src/pages/workspace/perDiem/WorkspacePerDiemPage.tsxline 239, the "Download CSV" option insidesecondaryActionsis wrapped inif (hasVisibleSubRates). BecausehasVisibleSubRatesevaluates to false when a workspace has no per diem rates defined yet (line 180), the "Download CSV" option is excluded from the "More" overflow menu. The menu omits it.What changes do you think we should make in order to solve the problem?
In
src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx:secondaryActions(lines 239-260), remove theif (hasVisibleSubRates)condition guarding the "Download CSV" item so that the option is always appended tomenuItems.useMemodependency array forsecondaryActions(line 269), removehasVisibleSubRatesbecause it is no longer consumed by the memoized callback.downloadPerDiemCSVinsrc/libs/actions/Policy/PerDiem.tsrequires no changes because it invokesfileDownloadwithWRITE_COMMANDS.EXPORT_PER_DIEM_CSVandpolicyID. The backend already supports exporting the standard Per Diem CSV header template when a workspace contains zero rates (as currently demonstrated in Classic Expensify).What alternative solutions did you explore? (Optional)
I considered adding a dedicated "Download template" button inside
emptyState(line 360) alongside the "Import spreadsheet" button. However, keeping "Download CSV" in the "More" overflow menu directly satisfies the reported requirement and maintains UX consistency with other workspace pages such as Members (WorkspaceMembersPage.tsx).14 remaining items
JS00001 commentedon Oct 19, 2026
Waiting on the FE PR
Eskalifer1 commentedon Oct 19, 2026
Hi @JS00001 was BE PR deployed? I still get error from BE
JS00001 commentedon Oct 19, 2026
No not yet sorry, it should be merged today
Eskalifer1 commentedon Oct 20, 2026
Waiting on BE PR
Eskalifer1 commentedon Oct 20, 2026
Gentle bump on this one @trjExpensify
JS00001 commentedon Oct 20, 2026
BE PR is merged, should be deployed to staging today
trjExpensify commentedon Oct 20, 2026
Can you download the Members list to CSV as an
Auditorvia Members > More > Download CSV? If not, then no here as well.melvin-bot commentedon Oct 21, 2026
📣 @Eskalifer1 We're missing your Upwork ID to automatically send you an offer for the Reviewer role.
Once you apply to the Upwork job, your Upwork ID will be stored and you will be automatically hired for future jobs!
JS00001 commentedon Oct 21, 2026
The BE PR is on staging
Eskalifer1 commentedon Oct 21, 2026
Hi @JS00001, i have already approved PR!
JS00001 commentedon Oct 21, 2026
even better, thanks!