X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fhelpers%2Frxjs.ts;h=2eaf0a055436be938ae2cffee67276401f1dfdd8;hb=dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709;hp=625bca0f7d6231daf75e312670af3c5de14655cd;hpb=afb7d2d5c6ca09d2c678781ae4dd3f527604c1b4;p=github%2FChocobozzz%2FPeerTube.git 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() ) }