From 656070292c59dcfef079b6b400ad4b8f489fc918 Mon Sep 17 00:00:00 2001 From: Linda Paiste Date: Sat, 17 Jun 2023 18:39:46 -0500 Subject: [PATCH] Don't show loader after the collection has been loaded. --- client/modules/User/components/Collection.jsx | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/client/modules/User/components/Collection.jsx b/client/modules/User/components/Collection.jsx index 563fd7d6ff..221633f990 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) {