Skip to content

Make InvoicesTab download produce a real file and handle download errors #191

Description

@Jagadeeshftw

📌 Description

InvoicesTab (src/features/settings/components/billing/InvoicesTab.tsx) has a handleDownloadInvoice() that sets link.href = '#' and never downloads a real PDF, with no error handling and a table that overflows on mobile.

💡 Why it matters: Users click "Download" and nothing usable happens.

🧩 Requirements and context

  • Fetch the real invoice file from the API and trigger a download.
  • Show a loading state on the row and an error message on failure.
  • Make the invoice table responsive on small screens.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b fix/invoices-download

2. Implement changes

  • Write/modify the relevant source: src/features/settings/components/billing/InvoicesTab.tsx
  • Write comprehensive tests: src/features/settings/components/billing/InvoicesTab.test.tsx
  • Add documentation: inline TSDoc
  • Include TSDoc doc comments
  • Validate security assumptions: use object URLs and revoke them

3. Test and commit

  • Run tests:
npm run test
  • Cover edge cases: download success, download error, mobile layout
  • Include test output and security notes in the PR description.

Example commit message

fix(billing): real invoice download with error handling

✅ Acceptance criteria

  • Download fetches and saves a real file
  • Loading + error states present
  • Table responsive on mobile
  • Tests cover success/error

🔒 Security notes

Create and revoke object URLs; never trust unsanitized filenames.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial CampaignGrantFox official campaign issuebugSomething isn't workingenhancementNew feature or requestfrontendFrontend / UI work

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions