Skip to content

Commit 98a5076

Browse files
101577: Fixed some SearchResultListElementComponents not rendering because of potential undefined dso
1 parent 190f245 commit 98a5076

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/app/shared/object-detail/my-dspace-result-detail-element/claimed-task-search-result/claimed-task-search-result-detail-element.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { followLink } from '../../../utils/follow-link-config.model';
1717
import { LinkService } from '../../../../core/cache/builders/link.service';
1818
import { Item } from '../../../../core/shared/item.model';
1919
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
20-
import { isNotEmpty } from '../../../empty.util';
20+
import { isNotEmpty, hasValue } from '../../../empty.util';
2121
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
2222

2323
/**
@@ -88,7 +88,9 @@ export class ClaimedTaskSearchResultDetailElementComponent extends SearchResultD
8888

8989
ngOnDestroy() {
9090
// This ensures the object is removed from cache, when action is performed on task
91-
this.objectCache.remove(this.dso._links.workflowitem.href);
91+
if (hasValue(this.dso)) {
92+
this.objectCache.remove(this.dso._links.workflowitem.href);
93+
}
9294
}
9395

9496
}

src/app/shared/object-detail/my-dspace-result-detail-element/pool-search-result/pool-search-result-detail-element.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { followLink } from '../../../utils/follow-link-config.model';
1717
import { LinkService } from '../../../../core/cache/builders/link.service';
1818
import { Item } from '../../../../core/shared/item.model';
1919
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
20-
import { isNotEmpty } from '../../../empty.util';
20+
import { isNotEmpty, hasValue } from '../../../empty.util';
2121
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
2222

2323
/**
@@ -89,7 +89,9 @@ export class PoolSearchResultDetailElementComponent extends SearchResultDetailEl
8989

9090
ngOnDestroy() {
9191
// This ensures the object is removed from cache, when action is performed on task
92-
this.objectCache.remove(this.dso._links.workflowitem.href);
92+
if (hasValue(this.dso)) {
93+
this.objectCache.remove(this.dso._links.workflowitem.href);
94+
}
9395
}
9496

9597
}

src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ObjectCacheService } from '../../../../core/cache/object-cache.service'
2222
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
2323
import { Item } from '../../../../core/shared/item.model';
2424
import { mergeMap, tap } from 'rxjs/operators';
25-
import { isNotEmpty } from '../../../empty.util';
25+
import { isNotEmpty, hasValue } from '../../../empty.util';
2626

2727
@Component({
2828
selector: 'ds-claimed-search-result-list-element',
@@ -101,7 +101,9 @@ export class ClaimedSearchResultListElementComponent extends SearchResultListEle
101101

102102
ngOnDestroy() {
103103
// This ensures the object is removed from cache, when action is performed on task
104-
this.objectCache.remove(this.dso._links.workflowitem.href);
104+
if (hasValue(this.dso)) {
105+
this.objectCache.remove(this.dso._links.workflowitem.href);
106+
}
105107
}
106108

107109
}

src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interfac
2323
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
2424
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
2525
import { Item } from '../../../../core/shared/item.model';
26-
import { isNotEmpty } from '../../../empty.util';
26+
import { isNotEmpty, hasValue } from '../../../empty.util';
2727

2828
/**
2929
* This component renders pool task object for the search result in the list view.
@@ -111,6 +111,8 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
111111

112112
ngOnDestroy() {
113113
// This ensures the object is removed from cache, when action is performed on task
114-
this.objectCache.remove(this.dso._links.workflowitem.href);
114+
if (hasValue(this.dso)) {
115+
this.objectCache.remove(this.dso._links.workflowitem.href);
116+
}
115117
}
116118
}

0 commit comments

Comments
 (0)