Fix/balance shows zero after send - #2
Merged
Conversation
Reported by a tester: "After transection the balance show zero and few
seconds latter balance appears."
A send marks the input note spent and writes the change back with
leafIndex: null, because the change genuinely cannot move until the
folder runs. spendableNotes() filters on leafIndex !== null, so the
change counted as *pending* — and the Home headline rendered
money.spendable. Paying 100 out of 1000 therefore showed 0.00 while the
user still owned 900, for a full fold cycle.
Recording the change note (an earlier fix) stopped the money vanishing
from the data. It did not stop the headline reading the one number that
excluded it.
Money now carries `total` (spendable + pending), and the two are used
for different questions:
- display `total` — Home, Profile, Add money: "what do I have"
- gate on `spendable` — every Send affordability check: "what can
leave right now"
Showing pending money in the total is not the same as offering it: a
note that is not yet a leaf still cannot be spent, and the Send screen
still refuses it, so the refusal never moves from the screen to the
contract.
Labels follow the numbers — Home is "Private balance" rather than
"Available balance", and Send says "Available to send" — so a larger
figure on Home than on Send is self-explaining.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the accuracy and clarity of balance reporting throughout the application, ensuring users always see the total funds they own (including pending/unfolded change) rather than only the immediately spendable amount. This addresses confusion where balances temporarily appeared as zero after sending funds, even though the user still owned most of their money. The changes also enhance user feedback reporting and add public backend health endpoints for easier review.
Balance reporting improvements:
HomeScreen,DepositScreen,ProfileScreen) to show thetotalowned funds (spendable + pending), with clear explanations and UI cues for pending funds. This prevents the balance from appearing to "vanish" immediately after a send. (mobile/src/features/home.tsx[1]mobile/src/app/deposit.tsx[2]mobile/src/features/profile.tsx[3]Moneytype anduseMoneyhook to include atotalfield, and clarified in comments and documentation when to usetotalvsspendablefor display and gating send actions. (mobile/src/hooks/use-money.ts[1] [2] [3] [4]spendableis used for send gating, with UI explanations for the difference between owned and available funds. (mobile/src/app/send.tsxmobile/src/app/send.tsxR554-R561)User feedback and documentation updates:
README.mdto reflect two tester reports, how both were addressed, and improved the ratings table to show scores per respondent and averages. Added explanations for the impact of the previous balance bug on user confidence. (README.mdREADME.mdL249-R293)README.mdREADME.mdL163-R163)README.mdREADME.mdR310-R314)Backend health endpoints:
/healthz,/readyz,/pool/status) in theREADME.md, with explanations of their purposes and example responses, to facilitate independent reviewer verification of backend status. (README.mdREADME.mdR225-R243)These changes collectively improve user trust, make the app's behavior more intuitive, and make the system easier to review and monitor.