-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display correct balance from state when creating an account that already holds funds #1759
Conversation
const { accounts } = AccountTrackerController; | ||
const selectedAccount = accounts[selectedAddress]; | ||
const selectedAccountHasBalance = | ||
selectedAccount && Object.prototype.hasOwnProperty.call(selectedAccount, BALANCE_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally i would just use obj.hasOwnProperty()
directly here, but I guess we don't allow that with this rule: https://eslint.org/docs/rules/no-prototype-builtins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to move this logic up into getAccounts()
in the AccountList
parent component? That way we can be sure the item.balance
passed down is always accurate and we can leave the child AccountElement
unconnected/stateless.
@EtDu I just tried to move this logic into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SOLID
5c23554
to
4cb235f
Compare
grouping this in with #1797 |
Description
re: https://trello.com/c/NytEfYLU/191-after-importing-a-wallet-with-seedphrase-new-account-shows-0-balance-until-another-account-is-created
Previously when adding a new account that already has funds we'd see it displayed with zero in the drawer:
(you can see the fiat balance is correct in the background)
Now we check state to see if we have the amount and display it if there's a balance for the matching account:
Checklist
Issue
Resolves #???