From b0f25c4dae5d76ae6e502bcdce85696035ba68b7 Mon Sep 17 00:00:00 2001 From: Art Lowel <art@ArtMac.local> Date: Fri, 24 Feb 2017 13:11:14 +0100 Subject: [PATCH] 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. --- src/app/core/data-services/data.effects.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/core/data-services/data.effects.ts b/src/app/core/data-services/data.effects.ts index 545ef6ec45..ee7318da12 100644 --- a/src/app/core/data-services/data.effects.ts +++ b/src/app/core/data-services/data.effects.ts @@ -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) => { -- GitLab