diff --git a/client/modules/User/components/Collection.jsx b/client/modules/User/components/Collection.jsx index 7379bd36f1..3301dfbb5c 100644 --- a/client/modules/User/components/Collection.jsx +++ b/client/modules/User/components/Collection.jsx @@ -205,7 +205,7 @@ class Collection extends React.Component { if ( this.props.user != null && this.props.user.username && - this.props.collection.owner.username === this.props.user.username + this.props.collection?.owner?.username === this.props.user.username ) { isOwner = true; } @@ -214,7 +214,7 @@ class Collection extends React.Component { } hasCollection() { - return !this.props.loading && this.props.collection != null; + return !!this.props.collection; } hasCollectionItems() { @@ -222,7 +222,7 @@ class Collection extends React.Component { } _renderLoader() { - if (this.props.loading) return ; + if (this.props.loading && !this.hasCollection()) return ; return null; } @@ -336,11 +336,7 @@ class Collection extends React.Component { } _renderEmptyTable() { - const isLoading = this.props.loading; - const hasCollectionItems = - this.props.collection != null && this.props.collection.items.length > 0; - - if (!isLoading && !hasCollectionItems) { + if (this.hasCollection() && !this.hasCollectionItems()) { return (

{this.props.t('Collection.NoSketches')} @@ -516,13 +512,7 @@ Collection.propTypes = { Collection.defaultProps = { username: undefined, - collection: { - id: undefined, - items: [], - owner: { - username: undefined - } - } + collection: null }; function mapStateToProps(state, ownProps) {