Skip to content

Commit

Permalink
Refresh the list of delegates after the list unmounted
Browse files Browse the repository at this point in the history
  • Loading branch information
reyraa committed May 22, 2018
1 parent 06d7e13 commit 5444705
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/votingListView/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { voteToggled, votesFetched, delegatesFetched } from '../../actions/voting';
import { voteToggled, votesFetched, delegatesFetched, delegatesAdded } from '../../actions/voting';
import VotingListView from './votingListView';

const mapStateToProps = state => ({
Expand All @@ -18,6 +18,9 @@ const mapDispatchToProps = dispatch => ({
voteToggled: data => dispatch(voteToggled(data)),
votesFetched: data => dispatch(votesFetched(data)),
delegatesFetched: data => dispatch(delegatesFetched(data)),
delegatesCleared: () => dispatch(delegatesAdded({
list: [], totalDelegates: 0, refresh: true,
})),
});

export default connect(mapStateToProps, mapDispatchToProps)(translate()(VotingListView));
4 changes: 4 additions & 0 deletions src/components/votingListView/votingListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class VotingListView extends React.Component {
}
}

componentWillUnmount() {
this.props.delegatesCleared();
}

loadVotedDelegates(refresh) {
/* istanbul-ignore-else */
if (!this.freezeLoading) {
Expand Down

0 comments on commit 5444705

Please sign in to comment.