fix: update transaction amount display to use formatted number with currency#378
Conversation
📝 WalkthroughWalkthroughThe Amount field in transaction details changes its formatting approach. Instead of using a locale-aware currency formatter (formatCurrency), it now uses simple thousand-separator formatting (formatNumberWithCommas) followed by the currency code. This removes locale-specific currency formatting. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/components/transaction/TransactionDetails.tsx (1)
83-87:⚠️ Potential issue | 🟡 MinorBlob URL is never revoked — minor memory leak.
URL.createObjectURLkeeps the blob alive until the document is destroyed. Add a revocation call after handing off the URL to the browser:🛠️ Proposed fix
const pdfUrl = URL.createObjectURL(blob); window.open(pdfUrl, "_blank"); + // Revoke after a short delay to let the browser start loading the resource + setTimeout(() => URL.revokeObjectURL(pdfUrl), 1000);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/components/transaction/TransactionDetails.tsx` around lines 83 - 87, The Blob URL created for the generated PDF (variable pdfUrl from URL.createObjectURL(blob) in TransactionDetails / the code that calls pdf(<PDFReceipt ... />).toBlob()) is never revoked, causing a minor memory leak; after opening/handing off the URL to the browser (window.open(pdfUrl, "_blank") or when using an anchor click), call URL.revokeObjectURL(pdfUrl) once the browser has started using it (e.g., schedule a short setTimeout revoke or revoke on the opened window/anchor load) so the blob can be released. Ensure you reference the pdfUrl and blob variables and revoke the URL after handing it off.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@app/components/transaction/TransactionDetails.tsx`:
- Around line 83-87: The Blob URL created for the generated PDF (variable pdfUrl
from URL.createObjectURL(blob) in TransactionDetails / the code that calls
pdf(<PDFReceipt ... />).toBlob()) is never revoked, causing a minor memory leak;
after opening/handing off the URL to the browser (window.open(pdfUrl, "_blank")
or when using an anchor click), call URL.revokeObjectURL(pdfUrl) once the
browser has started using it (e.g., schedule a short setTimeout revoke or revoke
on the opened window/anchor load) so the blob can be released. Ensure you
reference the pdfUrl and blob variables and revoke the URL after handing it off.
Description
This pull request updates the way transaction amounts are displayed in the
TransactionDetailscomponent to improve readability and consistency.Display improvements:
amount_receivedvalue to useformatNumberWithCommasinstead offormatCurrency, and now shows the currency code directly after the number, rather than formatting based on locale. (TransactionDetailsinapp/components/transaction/TransactionDetails.tsx)References
Testing
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.
Summary by CodeRabbit