@@ -205,7 +205,7 @@ class Collection extends React.Component {
205
205
if (
206
206
this . props . user != null &&
207
207
this . props . user . username &&
208
- this . props . collection . owner . username === this . props . user . username
208
+ this . props . collection ? .owner ? .username === this . props . user . username
209
209
) {
210
210
isOwner = true ;
211
211
}
@@ -214,15 +214,15 @@ class Collection extends React.Component {
214
214
}
215
215
216
216
hasCollection ( ) {
217
- return ! this . props . loading && this . props . collection != null ;
217
+ return ! ! this . props . collection ;
218
218
}
219
219
220
220
hasCollectionItems ( ) {
221
221
return this . hasCollection ( ) && this . props . collection . items . length > 0 ;
222
222
}
223
223
224
224
_renderLoader ( ) {
225
- if ( this . props . loading ) return < Loader /> ;
225
+ if ( this . props . loading && ! this . hasCollection ( ) ) return < Loader /> ;
226
226
return null ;
227
227
}
228
228
@@ -336,11 +336,7 @@ class Collection extends React.Component {
336
336
}
337
337
338
338
_renderEmptyTable ( ) {
339
- const isLoading = this . props . loading ;
340
- const hasCollectionItems =
341
- this . props . collection != null && this . props . collection . items . length > 0 ;
342
-
343
- if ( ! isLoading && ! hasCollectionItems ) {
339
+ if ( this . hasCollection ( ) && ! this . hasCollectionItems ( ) ) {
344
340
return (
345
341
< p className = "collection-empty-message" >
346
342
{ this . props . t ( 'Collection.NoSketches' ) }
@@ -516,13 +512,7 @@ Collection.propTypes = {
516
512
517
513
Collection . defaultProps = {
518
514
username : undefined ,
519
- collection : {
520
- id : undefined ,
521
- items : [ ] ,
522
- owner : {
523
- username : undefined
524
- }
525
- }
515
+ collection : null
526
516
} ;
527
517
528
518
function mapStateToProps ( state , ownProps ) {
0 commit comments