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.
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);
});