diff --git a/js/src/ui/SectionList/sectionList.js b/js/src/ui/SectionList/sectionList.js index b326b9ed8..f499d8962 100644 --- a/js/src/ui/SectionList/sectionList.js +++ b/js/src/ui/SectionList/sectionList.js @@ -46,10 +46,18 @@ export default class SectionList extends Component { return null; } + const rendered = items + .map(this.renderItem) + .filter((item) => item); + + if (!rendered.length) { + return null; + } + return (
{ this.renderOverlay() } - { chunkArray(items, ITEMS_PER_ROW).map(this.renderRow) } + { chunkArray(rendered, ITEMS_PER_ROW).map(this.renderRow) }
); } @@ -74,11 +82,7 @@ export default class SectionList extends Component { className={ styles.row } key={ `row_${index}` } > - { - row - .map(this.renderItem) - .filter((item) => item) - } + { row } ); } diff --git a/js/src/ui/SectionList/sectionList.spec.js b/js/src/ui/SectionList/sectionList.spec.js index 9022db79d..29c6d1d56 100644 --- a/js/src/ui/SectionList/sectionList.spec.js +++ b/js/src/ui/SectionList/sectionList.spec.js @@ -74,10 +74,6 @@ describe('SectionList', () => { it('adds a key for the row', () => { expect(row.key).to.be.ok; }); - - it('calls renderItem for the items', () => { - expect(instance.renderItem).to.have.been.calledTwice; - }); }); describe('renderItem', () => { diff --git a/js/src/views/Home/Accounts/accounts.js b/js/src/views/Home/Accounts/accounts.js index 73ffce43b..f397994ff 100644 --- a/js/src/views/Home/Accounts/accounts.js +++ b/js/src/views/Home/Accounts/accounts.js @@ -80,7 +80,12 @@ class Accounts extends Component { return null; } - const account = accountsInfo[history.entry] || { meta: {} }; + const account = accountsInfo[history.entry]; + + if (!account) { + return null; + } + let linkType = 'addresses'; if (account.uuid) {