Don't show addresses while loading balances (fix flash of unsorted)

This commit is contained in:
Nicolas Gotchac 2016-12-10 12:44:48 +01:00
parent 0d9b1882a3
commit 51b9034a5e

View File

@ -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,14 +72,28 @@ 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>
{ this.renderAccountsList() }
</Page>
</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 <List
link='address' link='address'
search={ searchValues } search={ searchValues }
@ -87,9 +101,8 @@ class Addresses extends Component {
balances={ balances } balances={ balances }
empty={ !hasContacts } empty={ !hasContacts }
order={ sortOrder } order={ sortOrder }
handleAddSearchToken={ this.onAddSearchToken } /> handleAddSearchToken={ this.onAddSearchToken }
</Page> />
</div>
); );
} }