Skip to content
Snippets Groups Projects
Commit b0f25c4d authored by Art Lowel's avatar Art Lowel
Browse files

Fixed an issue where, if you called findAll or findById multiple times in a...

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.
parent 7fb8360f
Branches
Tags
No related merge requests found
......@@ -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) => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment