Skip to content

Commit

Permalink
Merge pull request #543 from eco-stake/fix-delegations-refresh-networ…
Browse files Browse the repository at this point in the history
…k-change

Fix delegations refresh on network change
  • Loading branch information
tombeynon authored Jun 26, 2022
2 parents c50184b + d4992be commit c321029
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/Delegations.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,20 @@ class Delegations extends React.Component {
}

async componentDidUpdate(prevProps, prevState) {
if (this.props.network !== prevProps.network) {
this.clearRefreshInterval()
this.setState({ delegations: undefined, validatorApy: {} })
}

if (prevProps.validator !== this.props.validator && this.props.validator && !this.state.validatorModal.show) {
this.showValidatorModal(this.props.validator)
}

if (this.props.address !== prevProps.address) {
if ((this.props.network !== prevProps.network && !this.props.address)
|| (this.props.address !== prevProps.address)) {
this.clearRefreshInterval()
const isNanoLedger = this.props.stargateClient?.getIsNanoLedger();
this.setState({
isNanoLedger: isNanoLedger,
delegations: undefined,
validatorApy: {},
operatorGrants: {},
error: null,
operatorGrants: {}
});
await this.getDelegations()
this.refresh();
Expand Down

0 comments on commit c321029

Please sign in to comment.