mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Fixed an issue where, if you called findAll or findById multiple times in a row, all network requests were cancelled except for the last one.
This commit is contained in:
@@ -30,7 +30,7 @@ export abstract class DataEffects<T extends CacheableObject> {
|
||||
protected findAll = this.actions$
|
||||
.ofType(RequestCacheActionTypes.FIND_ALL_REQUEST)
|
||||
.filter((action: FindAllRequestCacheAction) => action.payload.service === this.dataService.name)
|
||||
.switchMap((action: FindAllRequestCacheAction) => {
|
||||
.flatMap((action: FindAllRequestCacheAction) => {
|
||||
//TODO scope, pagination, sorting -> when we know how that works in rest
|
||||
return this.restApi.get(this.getFindAllEndpoint(action))
|
||||
.map((data: DSpaceRESTV2Response) => this.getSerializer().deserializeArray(data))
|
||||
@@ -47,7 +47,7 @@ export abstract class DataEffects<T extends CacheableObject> {
|
||||
protected findById = this.actions$
|
||||
.ofType(RequestCacheActionTypes.FIND_BY_ID_REQUEST)
|
||||
.filter((action: FindAllRequestCacheAction) => action.payload.service === this.dataService.name)
|
||||
.switchMap((action: FindByIDRequestCacheAction) => {
|
||||
.flatMap((action: FindByIDRequestCacheAction) => {
|
||||
return this.restApi.get(this.getFindByIdEndpoint(action))
|
||||
.map((data: DSpaceRESTV2Response) => this.getSerializer().deserialize(data))
|
||||
.do((t: T) => {
|
||||
|
Reference in New Issue
Block a user