Closed nkfoss closed 4 years ago
It seems like my initial thought on handling this issue was wrong. Here's what I tried:
// SetList Component properties
paramsSub: Subscription;
//setupSubs()
this.paramsSub = this.activatedRoute.params
.pipe(takeUntil(this.unsubNotifier))
.subscribe(
(params: Params) => {
this.date = params['date'];
this.workoutService.fetchWorkout(this.date);
}
);
Once again, fetchWorkout() is getting called in this process. We may just have to accept this and find an appropriate place to use it.
(I suspect this has something to do with the params subscription being something the Angular handles by default. The other subscriptions in setupSubs() are subscribing to an observables that are returned from my custom functions. However, the params sub has two key differences:
Fixed for now. See reference above.
This is because the subscription is setup incorrectly. This should be as a subscription property in the component, and then handled in OnDestroy.