Questions tagged [concatmap]

concatMap is a function from RxJava library, which returns a new Observable that emits items resulting from applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then emitting the items that result from concatinating those resulting Observables.

concatMap is a function from RxJava library, which returns a new Observable that emits items resulting from applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then emitting the items that result from concatinating those resulting Observables.

67 questions
1
vote
2 answers

Observable concatMap does things on the main thread for some reasons

I've got a chain of Observables and a dialog that is dismissing after everything is finished.The order is this: 1 api call get ResponseBody 2 take response body process (not ui thread) 3 other process (not ui thread) During the first call the dialog…
dvdciri
  • 441
  • 6
  • 19
0
votes
1 answer

How to: Rxjs Observable Process values in order (concatMap), handling errors(catchError), without 'stopping' (switchmap)

Goal: Process(async Call) all elements from Observable in order, finishing one before the next (concatMap style) while handling errors from bad elements without stopping. It is understood that an observable that errors, will stop its emissions As…
redevill
  • 341
  • 1
  • 3
  • 9
0
votes
1 answer

RxJS how to call multi API with conditional

My situation: If A is true { Call API 1 If B is true { Call API 2 } else { If B is true { Call API 2 } } My current solution if (A) { this.aservice.getA().subscribe((resA) => { if (B) { this.bservice.getB().subscribe((resB) => { …
David
  • 3
  • 1
0
votes
1 answer

rxjs pipeline to filter documents based on conditions and return array

In my Angular service I am trying to write a pipeline that would take a list of documents. Filter them based on some conditions, for example property value must not be null, etc. Then the document that are returned from filter, I want to make Api…
0
votes
1 answer

Get previous observable result to fork join pipe RXJS

First Http call to fetch Shipment Data IF shipment data is NOT AVAILABLE exceution will be stop with showing error IF shipment data is AVAILABLE i need to call second and third calls paralalley I used fork join to call paralell request and after…
Thushara
  • 236
  • 3
  • 19
0
votes
2 answers

Angular RXJS Sequential multiple post request

I tried to do following function with concat map. but i'm not sure what is the correct way for that. //Req 01 await this.shippingInfoService.getShipmentInfoByCardId(this.data.CardId).then(async (shipmentData) => { if (shipmentData !=…
Thushara
  • 236
  • 3
  • 19
0
votes
2 answers

How to extract result inside subscribe block while using two concatmap inside pipe in rxjs Angular

I have a code like following: this.security.isLoggedIn$ .pipe( distinctUntilChanged(), switchMap( (isLoggedInApp: boolean) => isLoggedInApp ? of(true).pipe( …
0
votes
1 answer

rxjs chain can be triggered parallel but internal logic should be synchrounous (.next with concat)

Fields in my case can be finalized (actions linked to a field were executed). When they are done, I need to update 2 lists: alreadyExecutedFields: string[] --> plain array remainingFieldsToExecute: BehaviorSubject --> behavior subject,…
jmeire
  • 1
  • 1
0
votes
1 answer

RxJava Flowable> do operation on each item and then do operation on resulted list

I have a Flowable> for which I want to : Make an operation on each item After that, I want to make an operation on the whole resulted list. This is not working now because it looks like is entering in an infinite loop:: return…
mantc_sdr
  • 451
  • 3
  • 17
0
votes
1 answer

Angular 12 ConcatMap how i can do it?

I want to concat the tow api call. How i can use ConcatMap on this code ? getHIndices(code) { this.api.getInstrumentHistoryIndices(code, '3M') .subscribe((response: {}) => { …
0
votes
1 answer

Side effects with BehaviorSubject and concatMap

This is my first time experimenting with BehaviorSubject, async pipes and concatMap so I'm facing some problems updating data in my DOM. I have: private profilesStore = new BehaviorSubject(null); profiles$ = this.profilesStore.asObservable(); …
soni
  • 687
  • 1
  • 8
  • 23
0
votes
0 answers

Angular concatMap not calling next API

I am trying to make sequential http calls but the next function (i.e. getGroups) is not called. These are my function signatures: getTokenForGroups() : Observable getGroups() : Observable // is not called I've checked getTokenForGroups…
ahnirab
  • 168
  • 1
  • 11
0
votes
2 answers

How to properly chain concatMaps in Angular RxJS

this.route.params.pipe( concatMap((param) => { const ein = param['nonprofit-id']; return this.nonprofitService.getNonprofit(ein).pipe( concatMap((nonprofit) => { this.nonprofit = nonprofit; …
Andrew
  • 432
  • 2
  • 14
0
votes
1 answer

how to make concatMap nested

I need to obtain a series of data for each of the dates of origin that I have in an array and I need to obtain them in order so I use concatMap to go through my observable of dates and when I obtain the first group of values everything goes…
kintela
  • 1,283
  • 1
  • 14
  • 32
0
votes
2 answers

Struggling with flatMap vs concatMap in rxJs

I am struggling to understand the difference between the flatMap and concatMap in rxJs. The most clear answer that I could understand was that here difference-between-concatmap-and-flatmap So I went and tried things out by my self. import…
Panagiotis Bougioukos
  • 15,955
  • 2
  • 30
  • 47