Skip to content

Commit 0923485

Browse files
committed
[DSC-1974] Disable cache when retrieving the item with the resolver
1 parent 552f6bb commit 0923485

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/app/cris-item-page/cris-item-page.resolver.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { Observable } from 'rxjs';
33
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
44
import { RemoteData } from '../core/data/remote-data';
55
import { ItemDataService } from '../core/data/item-data.service';
6-
import { followLink } from '../shared/utils/follow-link-config.model';
76
import { Item } from '../core/shared/item.model';
87
import { getFirstCompletedRemoteData } from '../core/shared/operators';
8+
import { ITEM_PAGE_LINKS_TO_FOLLOW } from '../item-page/item.resolver';
99

1010
/**
1111
* This class represents a resolver that requests a specific item before the route is activated
@@ -25,13 +25,9 @@ export class CrisItemPageResolver implements Resolve<RemoteData<Item>> {
2525
* or an error if something went wrong
2626
*/
2727
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Item>> {
28-
// TODO temporary disable cache to have always an update item, check if after update with 7.3, it's only necessary to invalidate a cache on edit item saving
2928
return this.itemService.findById(route.params.id,
30-
false, true,
31-
followLink('owningCollection'),
32-
followLink('bundles'),
33-
followLink('relationships'),
34-
followLink('version', {}, followLink('versionhistory')),
29+
true, true,
30+
...ITEM_PAGE_LINKS_TO_FOLLOW
3531
).pipe(
3632
getFirstCompletedRemoteData()
3733
);

src/app/item-page/item.resolver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ export class ItemResolver implements Resolve<RemoteData<Item>> {
4545
* or an error if something went wrong
4646
*/
4747
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Item>> {
48+
// Fetch item with cache disabled to have always a fresh item object
4849
const itemRD$ = this.itemService.findById(route.params.id,
4950
false,
50-
false,
51+
true,
5152
...ITEM_PAGE_LINKS_TO_FOLLOW
5253
).pipe(
5354
getFirstCompletedRemoteData(),

0 commit comments

Comments
 (0)