Don't show addresses while loading balances (fix flash of unsorted)
This commit is contained in:
parent
0d9b1882a3
commit
51b9034a5e
@ -23,7 +23,7 @@ import { uniq, isEqual } from 'lodash';
|
|||||||
import List from '../Accounts/List';
|
import List from '../Accounts/List';
|
||||||
import Summary from '../Accounts/Summary';
|
import Summary from '../Accounts/Summary';
|
||||||
import { AddAddress } from '~/modals';
|
import { AddAddress } from '~/modals';
|
||||||
import { Actionbar, ActionbarExport, ActionbarImport, ActionbarSearch, ActionbarSort, Button, Page } from '~/ui';
|
import { Actionbar, ActionbarExport, ActionbarImport, ActionbarSearch, ActionbarSort, Button, Page, Loading } from '~/ui';
|
||||||
import { setVisibleAccounts } from '~/redux/providers/personalActions';
|
import { setVisibleAccounts } from '~/redux/providers/personalActions';
|
||||||
|
|
||||||
import styles from './addresses.css';
|
import styles from './addresses.css';
|
||||||
@ -72,27 +72,40 @@ class Addresses extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { balances, contacts, hasContacts } = this.props;
|
|
||||||
const { searchValues, sortOrder } = this.state;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{ this.renderActionbar() }
|
{ this.renderActionbar() }
|
||||||
{ this.renderAddAddress() }
|
{ this.renderAddAddress() }
|
||||||
<Page>
|
<Page>
|
||||||
<List
|
{ this.renderAccountsList() }
|
||||||
link='address'
|
|
||||||
search={ searchValues }
|
|
||||||
accounts={ contacts }
|
|
||||||
balances={ balances }
|
|
||||||
empty={ !hasContacts }
|
|
||||||
order={ sortOrder }
|
|
||||||
handleAddSearchToken={ this.onAddSearchToken } />
|
|
||||||
</Page>
|
</Page>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderAccountsList () {
|
||||||
|
const { balances, contacts, hasContacts } = this.props;
|
||||||
|
const { searchValues, sortOrder } = this.state;
|
||||||
|
|
||||||
|
if (hasContacts && Object.keys(balances).length === 0) {
|
||||||
|
return (
|
||||||
|
<Loading size={ 3 } />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<List
|
||||||
|
link='address'
|
||||||
|
search={ searchValues }
|
||||||
|
accounts={ contacts }
|
||||||
|
balances={ balances }
|
||||||
|
empty={ !hasContacts }
|
||||||
|
order={ sortOrder }
|
||||||
|
handleAddSearchToken={ this.onAddSearchToken }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
renderSortButton () {
|
renderSortButton () {
|
||||||
const onChange = (sortOrder) => {
|
const onChange = (sortOrder) => {
|
||||||
this.setState({ sortOrder });
|
this.setState({ sortOrder });
|
||||||
|
Loading…
Reference in New Issue
Block a user