Questions tagged [combinelatest]

137 questions
22
votes
6 answers

what triggered combineLatest?

I have a few observables. And I need to know which one triggered the subscribe. Observable.combineLatest( this.tournamentsService.getUpcoming(), this.favoriteService.getFavoriteTournaments(), …
AlexZvl
  • 2,092
  • 4
  • 18
  • 32
15
votes
2 answers

Retain the type of mutiple Observable using combineLatest() from rxjs under Angular?

When my component loads, I need to consume two services. Both need to be finished before it makes sense to continue. The order of completion of those is random and shouldn't be composed serially. The setup follows the pattern below. const…
Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438
12
votes
1 answer

RxJS combineAll Operator, explanation

I'm trying to understand how does the combineAll operator work. I'm using the following example from the official documentation: import { take, map, combineAll } from 'rxjs/operators'; import { interval } from 'rxjs'; const source$ =…
Bil5
  • 502
  • 1
  • 5
  • 15
11
votes
1 answer

ngrx - createSelector vs Observable.combineLatest

I just ran into the custom selectors of @ngrx and I simply cannot be amazed by the feature. Following their use case of books for the selectedUser, I can't give a real good reason to use a custom selector such as : export const selectVisibleBooks =…
Kesem David
  • 2,135
  • 3
  • 27
  • 46
6
votes
4 answers

rx dart combine multiple streams to emit value whenever any of the streams emit a value

In RX dart there is the RX.combineLatest method to combine the results of a stream using a callback function. Problem is that it only emits a value when every stream has emitted a value. If one has not it does not emit. Merges the given Streams…
Code Spirit
  • 3,992
  • 4
  • 23
  • 34
5
votes
1 answer

How to have a separate error handling for each function in combineLatest?

I need to handle each function's error scenario in this combineLatest. I'll add the code below const combined = combineLatest( this.myservice1.fn1(param), this.myservice2.fn2(), this.myservice3.fn3()); const subscribe = combined.subscribe( …
Ramya S
  • 2,954
  • 5
  • 14
  • 24
4
votes
1 answer

CombineLatest, execute only once after all observables are complete

I'm trying to solve an issue. Currently, I'm opening a modal but I needed the combination of the 3 route observables for this. So, my code logic is something like this: combineLatest([obs1, obs2, obs3]) .subscribe(([s1, s2, s3]: any) => { …
Jonatan Lavado
  • 954
  • 2
  • 15
  • 26
4
votes
2 answers

Angular unit test combineLatest

I have started off with unit testing with Jest Framework in Angular since a while now. However i am stuck in a situation where I need to unit test combineLatest RxJS operator. My component looks like below. Component: public userData; public…
Mohammed Aamir K
  • 311
  • 5
  • 17
4
votes
1 answer

Swift Combine's CombineLatest does not fire in response to an update to one of its publishers

I am combining two publishers to determine what the center coordinate of a map view should be. The two publishers are: The user's initial location determined by a CLLocationManager (the first location reported once the CLLocationManager begins…
kcstricks
  • 1,489
  • 3
  • 17
  • 32
4
votes
0 answers

Why does rxjs 6 combineLatest have type error when upgrading from rxjs 5?

I have the following code which compiled without errors in rxjs 5: a$ = Observable.combineLatest([x$, y$]) .subscribe(([x, y]:[X, Y]) => { When I update to rxjs 6 the following error occurs: Argument of type '([x, y]: [X, Y]) => void' is not…
okhobb
  • 758
  • 8
  • 22
3
votes
1 answer

Swift Combine CombineLatest always fires twice

I have a singleton that's in charge of handling user parameter changes for logic operations across my app. The parameters are divided into two types, "influencing" and "steering", and each is represented by a CurrentValueSubject. In my central…
jbm
  • 1,248
  • 10
  • 22
3
votes
1 answer

CombineLatest operator is not emitting when inners publishers use subscribe(on:)

I'm observing an unexpected behavior regarding CombineLatest, if the inner publishers has subscribe(on:), the CombineLatest stream is not emitting any value. Notes: With Zip operator is working Moving the subscribe(on:) / receive(on:) to the…
3
votes
1 answer

combineLatest is fired only for first event

I have 3 events which I want to combine, and when one of them is fired, to call the service. I used combineLatest, but it works only if the first event is fired by the filterChanged. filterChanged is an local event, while the rest are events comed…
AlleXyS
  • 2,476
  • 2
  • 17
  • 37
3
votes
3 answers

How to use combineLatest where one of the streams is dependent of one of the others?

I have an Angular-resolver that fetch data from the backend. I have the following calls to perform: GetProject(projectId): Observable GetSites(projectId): Observable GetPersons(siteId): Observable I'm trying to use…
TheViking
  • 153
  • 3
  • 15
3
votes
1 answer

RxJava CombineLatest onError

I am using RxJava CombineLatest with two observables. My question is, will the combine onNext called if one of the observables ends with onError? The documentation shows happy scenario when both observables emits items properly but I couldn't find…
Moti Bartov
  • 3,454
  • 33
  • 42
1
2 3
9 10