Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
value: CONST.POLICY.SECONDARY_ACTIONS.IMPORT_SPREADSHEET,
});
}
if (hasVisibleSubRates) {
// Admins can download the CSV before adding rates, to use it as an import template
if (hasVisibleSubRates || canWritePerDiem) {
menuItems.push({
Comment on lines +240 to 241

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate the empty-template action on backend support

When an admin has no Per Diem rates, this new condition exposes the download action, but downloadPerDiemCSV() calls ExportPerDiemCSV, which currently rejects that exact case with “No rates found to be exported.” Consequently, the newly enabled action always ends in the download-failed modal and cannot provide the promised import template. This change should be coordinated with the backend support or otherwise generate/provide a valid empty template.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot What do you think about that?

Seems like we are wating on BE PR to be deployed: #104175 (comment)

Should we make any action here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No code change is needed. The Codex finding is valid, but the backend PR already fixes it, so the frontend should not work around it.

I recommend these steps:

  1. Keep this PR in draft, or mark it on hold, until the backend PR deploys. If it merges first, admins on empty workspaces get the "Download failed" modal.
  2. After the backend PR deploys, retest on a workspace with no rates. Clicking "Download CSV" should download a header-only CSV.
  3. Fill in the Tests and QA sections, then mark the PR ready for review.

Building the template in the frontend would duplicate the backend's CSV format and could drift from it, so I don't recommend it.


view run

icon: expensifyIcons.Download,
text: translate('spreadsheet.downloadCSV'),
Expand Down
Loading