From 5e7e46c7fe43ac4886d5533b6e2dfc7fa483f929 Mon Sep 17 00:00:00 2001 From: pnogal <paulina.nogal@wisc.edu> Date: Thu, 21 Feb 2019 10:18:34 -0600 Subject: [PATCH] Move subscription to onInit --- src/app/degree-planner/degree-planner.component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/degree-planner/degree-planner.component.ts b/src/app/degree-planner/degree-planner.component.ts index b87a209..7431643 100644 --- a/src/app/degree-planner/degree-planner.component.ts +++ b/src/app/degree-planner/degree-planner.component.ts @@ -87,6 +87,12 @@ export class DegreePlannerComponent implements OnInit, OnDestroy { map(years => Object.keys(years)), distinctUntilChanged(utils.compareStringArrays), ); + + this.activeTermSubscription = this.store + .pipe(select(selectors.getActiveTerms)) + .subscribe(terms => { + this.firstActiveTerm = terms[0]; + }); } // Unsubscribe from subs to prevent memeory leaks @@ -148,12 +154,6 @@ export class DegreePlannerComponent implements OnInit, OnDestroy { } public onMakePrimayClick(currentPlan: DegreePlan) { - this.activeTermSubscription = this.store - .pipe(select(selectors.getActiveTerms)) - .subscribe(terms => { - this.firstActiveTerm = terms[0]; - }); - const currentTerm: any = new GetTermDescriptionPipe().transform( this.firstActiveTerm, ); -- GitLab