Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

126
Visualizações
Is an event subscribed to an observable still fired on refresh?

I have an issue which I have been figuring out for a while now. I have this piece of code:

this.service.process(this.Object.id, this.Object.userId,this.pageNr)
.subscribe((data) => {
    this.processed.emit(this.pageNr);
});

Now when debugging I see that the process method is called, when I refresh in the middle of the process, I do not see the processed.emit().

So, is it possible that on refresh the process( which is one transaction) goes through, but subscribed "processed" does not happen?

If someone could give a link to more information that would be awesome, or maybe information about how to avoid this.

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Try this to avoid multiple subscription:

subscription:Subscription

    ...
    
if(!!this.subscription){
// unsubsribe from old subscription
this.subscription.unsubscribe();

}
this.subscription = this.service.process(this.Object.id, this.Object.userId,this.pageNr)
.subscribe((data) => {
    this.processed.emit(this.pageNr);
});
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda