From 2cc276f92fefeff88fcc74217e1174a3ddb3f074 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 18 Oct 2021 11:44:54 +0200 Subject: Fix find in bulk --- client/src/app/helpers/rxjs.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'client/src/app/helpers/rxjs.ts') diff --git a/client/src/app/helpers/rxjs.ts b/client/src/app/helpers/rxjs.ts index 625bca0f7..2eaf0a055 100644 --- a/client/src/app/helpers/rxjs.ts +++ b/client/src/app/helpers/rxjs.ts @@ -2,10 +2,10 @@ import { uniq } from 'lodash-es' import { Observable } from 'rxjs' import { bufferTime, distinctUntilChanged, filter, map, share, switchMap } from 'rxjs/operators' -function buildBulkObservable (options: { - notifierObservable: Observable +function buildBulkObservable

(options: { + notifierObservable: Observable

time: number - bulkGet: (params: T[]) => Observable + bulkGet: (params: P[]) => Observable }) { const { notifierObservable, time, bulkGet } = options @@ -14,7 +14,10 @@ function buildBulkObservable (options: { bufferTime(time), filter(params => params.length !== 0), map(params => uniq(params)), - switchMap(params => bulkGet(params)), + switchMap(params => { + return bulkGet(params) + .pipe(map(response => ({ params, response }))) + }), share() ) } -- cgit v1.2.3