Smarter balance fetching (#3605)
* Smarter dApps Manifest fetching... * Fetching only visible accounts (and don't delete other balances) #3590 * Moved balances action into BalancesActions #3590 * Fetch balances for accounts and contracts #3590 * Add balances to contract/address/account views #3590 * Fix transaction not fetching on first load * Remove console.warn * Fix pending tokens not showing #3154 * Fix tokens image update * Remove unused name in Header * Separate Tokens and ETH fetching #3590 * Remove unused isTest * Fetch Tokens Balance via Filter #3590 * Fix linting * Fix updating tokens image (#3590) * Fix contract balances * Improved Status * Fixing secureApi issues... * Fetch all tokens every 2 minutes (for safety) #3590 * PR changes fix * Fix Account error
This commit is contained in:
committed by
Jaco Greeff
parent
9fdab84305
commit
08c507daaa
@@ -26,6 +26,7 @@ import { Actionbar, Button, Page } from '../../ui';
|
||||
import Header from '../Account/Header';
|
||||
import Transactions from '../Account/Transactions';
|
||||
import Delete from './Delete';
|
||||
import { setVisibleAccounts } from '../../redux/providers/personalActions';
|
||||
|
||||
import styles from './address.css';
|
||||
|
||||
@@ -36,9 +37,10 @@ class Address extends Component {
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
setVisibleAccounts: PropTypes.func.isRequired,
|
||||
|
||||
contacts: PropTypes.object,
|
||||
balances: PropTypes.object,
|
||||
isTest: PropTypes.bool,
|
||||
params: PropTypes.object
|
||||
}
|
||||
|
||||
@@ -47,8 +49,31 @@ class Address extends Component {
|
||||
showEditDialog: false
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
this.setVisibleAccounts();
|
||||
}
|
||||
|
||||
componentWillReceiveProps (nextProps) {
|
||||
const prevAddress = this.props.params.address;
|
||||
const nextAddress = nextProps.params.address;
|
||||
|
||||
if (prevAddress !== nextAddress) {
|
||||
this.setVisibleAccounts(nextProps);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
this.props.setVisibleAccounts([]);
|
||||
}
|
||||
|
||||
setVisibleAccounts (props = this.props) {
|
||||
const { params, setVisibleAccounts } = props;
|
||||
const addresses = [ params.address ];
|
||||
setVisibleAccounts(addresses);
|
||||
}
|
||||
|
||||
render () {
|
||||
const { contacts, balances, isTest } = this.props;
|
||||
const { contacts, balances } = this.props;
|
||||
const { address } = this.props.params;
|
||||
const { showDeleteDialog } = this.state;
|
||||
|
||||
@@ -70,7 +95,6 @@ class Address extends Component {
|
||||
onClose={ this.closeDeleteDialog } />
|
||||
<Page>
|
||||
<Header
|
||||
isTest={ isTest }
|
||||
account={ contact }
|
||||
balance={ balance } />
|
||||
<Transactions
|
||||
@@ -134,17 +158,17 @@ class Address extends Component {
|
||||
function mapStateToProps (state) {
|
||||
const { contacts } = state.personal;
|
||||
const { balances } = state.balances;
|
||||
const { isTest } = state.nodeStatus;
|
||||
|
||||
return {
|
||||
isTest,
|
||||
contacts,
|
||||
balances
|
||||
};
|
||||
}
|
||||
|
||||
function mapDispatchToProps (dispatch) {
|
||||
return bindActionCreators({}, dispatch);
|
||||
return bindActionCreators({
|
||||
setVisibleAccounts
|
||||
}, dispatch);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
|
||||
Reference in New Issue
Block a user