fixed delegated amount not changing bug when from changes

This commit is contained in:
Sadaqat Ali 2022-02-15 13:16:27 +05:00
parent d5bdf24905
commit 2d43a4df3d

View File

@ -69,6 +69,13 @@ class DelegateScreen extends Component {
this.amountTextInput = React.createRef();
}
// Component Lifecycles
componentDidUpdate(prevProps, prevState) {
if (prevState.from !== this.state.from) {
this._fetchReceivedVestingShare();
}
}
// Component Functions
_setState = (key, value) => {
const { getAccountsWithUsername, balance } = this.props;
@ -146,6 +153,10 @@ class DelegateScreen extends Component {
this.setState({
delegatedHP: vestsToHp(vest_shares.amount, hivePerMVests).toFixed(3),
});
} else {
this.setState({
delegatedHP: 0,
});
}
} else {
this.setState({