Show only known accounts/wallets/addresses on Home (#4612)

* Don't render unknown entries

* Only render non-null items

* Remove (now) invalid failing test
This commit is contained in:
Jaco Greeff 2017-02-20 16:34:38 +01:00 committed by Gav Wood
parent 72998d3ce3
commit 44769fcd4a
3 changed files with 16 additions and 11 deletions

View File

@ -46,10 +46,18 @@ export default class SectionList extends Component {
return null; return null;
} }
const rendered = items
.map(this.renderItem)
.filter((item) => item);
if (!rendered.length) {
return null;
}
return ( return (
<section className={ [styles.section, className].join(' ') }> <section className={ [styles.section, className].join(' ') }>
{ this.renderOverlay() } { this.renderOverlay() }
{ chunkArray(items, ITEMS_PER_ROW).map(this.renderRow) } { chunkArray(rendered, ITEMS_PER_ROW).map(this.renderRow) }
</section> </section>
); );
} }
@ -74,11 +82,7 @@ export default class SectionList extends Component {
className={ styles.row } className={ styles.row }
key={ `row_${index}` } key={ `row_${index}` }
> >
{ { row }
row
.map(this.renderItem)
.filter((item) => item)
}
</div> </div>
); );
} }

View File

@ -74,10 +74,6 @@ describe('SectionList', () => {
it('adds a key for the row', () => { it('adds a key for the row', () => {
expect(row.key).to.be.ok; expect(row.key).to.be.ok;
}); });
it('calls renderItem for the items', () => {
expect(instance.renderItem).to.have.been.calledTwice;
});
}); });
describe('renderItem', () => { describe('renderItem', () => {

View File

@ -80,7 +80,12 @@ class Accounts extends Component {
return null; return null;
} }
const account = accountsInfo[history.entry] || { meta: {} }; const account = accountsInfo[history.entry];
if (!account) {
return null;
}
let linkType = 'addresses'; let linkType = 'addresses';
if (account.uuid) { if (account.uuid) {