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

125
Views
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 answers
Answer question

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 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!