Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
Can I subscribe inside the combineLatest by the return result?

I want to use combineLatest to get a bunch of result. Then one of result is passed as input parameter to do another subscribe call.

combineLatest([first, second, third, four, five]).pipe(take(1)).
   subscribe(([a, b, c, d, e]) => {
        this.showData1(a);
        this.showData2(b);
        this.showData3(c);
        this.showData4(d);
        if(e > 8) {
           this.myService.updateStatus(e).subscribe(
              result => this.setupStatus(result)
           );
       }
   });

The logic is from the 5 results, 4 of them are used for rendering screen. The last one I use it to do a subscribe, its returning result will used some where.

But I feel that it is not right because sometimes it seems this.setupStatus(result) is not running inside the combineLatest. Memory leak?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

hard to diagnose why it wouldn't be running without knowing more about the observables. but I'd do it something like this to avoid nested subscribes and make this a little easier to diagnose / manage:

combineLatest([first, second, third, four, five]).pipe(
   take(1),
   switchMap(([a, b, c, d, e]) => {
        this.showData1(a);
        this.showData2(b);
        this.showData3(c);
        this.showData4(d);
        return this.myService.updateStatus(e);
   })
).subscribe(result => this.setupStatus(result));

possibly structuring a little differently depending on when exactly I want things to happen.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda