fix: show 0 balance with decimals in classic denomination#467
fix: show 0 balance with decimals in classic denomination#467
Conversation
Code Review for PR #467SummaryThis PR fixes issue #342 by ensuring that zero balances display with proper decimal places (0.00000000) in classic BTC denomination, maintaining consistency with the iOS and React Native versions of Bitkit. ✅ Positive Aspects
📋 Code Quality & Best PracticesGood:
Minor Suggestions:
🐛 Potential IssuesNone identified. The change is focused and correct. ⚡ Performance ConsiderationsNo concerns. The change is minimal:
🔒 Security ConcernsNone. This is a pure formatting change with no security implications. 🧪 Test CoverageObservation: There are no direct unit tests for Recommendation: Consider adding unit tests to cover edge cases like zero values, 1 BTC, and fractional values. Note: I see you have E2E tests referenced (bitkit-e2e-tests #46), which is good for catching visual regressions, but unit tests would provide faster feedback during development. ✨ Overall AssessmentStatus: LGTM with minor suggestion This is a clean, focused fix that properly addresses the reported issue. The implementation is correct and the code quality is good. Recommendation: Approve and merge, with optional follow-up to add unit tests for these formatting functions. Nice work on the fix! |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the display of zero Bitcoin balance in classic denomination to show all 8 decimal places (e.g., "0.00000000" instead of "0"), ensuring consistency with the iOS and React Native versions of Bitkit.
- Changed the decimal format pattern from
"###.########"(which hides trailing zeros) to"0.00000000"(which enforces 8 decimal places) - Updated the formatter configuration to explicitly set minimum and maximum fraction digits to
CLASSIC_DECIMALS(8) - Removed unnecessary intermediate variable
satsfor cleaner code
Pull Request Review: Fix Classic BTC Display for Zero BalanceOverviewThis PR fixes issue #342 where zero balances in Classic BTC denomination were displayed as 0 instead of 0.00000000. The fix ensures consistency with bitkit-ios and the React Native version. Code Quality ✅Strengths:
Suggestions:
Potential Bugs/Issues ✅No critical bugs identified, observations:
Performance Considerations ✅Positive impact:
Security Concerns ✅No security issues. Changes maintain type safety, no user input vulnerabilities, and use safe BigDecimal operations. Test Coverage
|
ovitrif
left a comment
There was a problem hiding this comment.
👏🏻 Thanks for this nice work
Closes #342.
Description
Show 0 balance with decimals in classic denomination.
To be consistent with bitkit-ios and RN.
Preview
QA Notes
synonymdev/bitkit-e2e-tests#46