Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

83
Views
combineLatest but remove completed observables

How can I combine the latest values but remove the completed observables dynamically? The combineLatest operator does not remove completed observables, it just repeats the last value they emitted until all observables complete.

I wanted something like this:

combineLatestAlive([interval(100).pipe(take(2)), interval(100)]).subscribe(console.log)

//[0,0]
//[1,0]
//[1,1]
//[1]
//[2] ... and so on

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I added two operators.

  1. endWith: Append end mark like undefined
  2. map: Transform array
combineLatest([interval(100).pipe(take(2), endWith(undefined)), interval(100)]).pipe(
    map(values => values.filter(v => v !== undefined))
  ).subscribe(console.log);

result is: (your wanted result has [1, 1] but [1, is already completed value.)

[ 0, 0 ]
[ 1, 0 ]
[ 0 ]
[ 1 ]
[ 2 ]
...
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!