From 1a09b94f24e917bda2f3af3b12e8851b42f155b8 Mon Sep 17 00:00:00 2001 From: ievavold <ievavold@wisc.edu> Date: Wed, 20 Mar 2019 12:35:52 -0500 Subject: [PATCH] use trackBy to prevent all years from being rebuilt --- src/app/degree-planner/degree-planner.component.html | 7 ++++--- src/app/degree-planner/degree-planner.component.ts | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/degree-planner/degree-planner.component.html b/src/app/degree-planner/degree-planner.component.html index 42f91c2..d40e447 100644 --- a/src/app/degree-planner/degree-planner.component.html +++ b/src/app/degree-planner/degree-planner.component.html @@ -157,9 +157,10 @@ style="margin: 24px"> <div id="year-mask" *ngIf="(isLoadingPlan$ | async)"></div> <mat-accordion multi="true"> - <ng-container *ngFor="let yearCode of (yearCodes$ | async)"> - <cse-year-container [yearCode]="yearCode"></cse-year-container> - </ng-container> + <cse-year-container + *ngFor="let yearCode of yearCodes$ | async; trackBy: trackYearCodes" + [yearCode]="yearCode"> + </cse-year-container> </mat-accordion> </div> </mat-sidenav-content> diff --git a/src/app/degree-planner/degree-planner.component.ts b/src/app/degree-planner/degree-planner.component.ts index d49e30c..075d5a9 100644 --- a/src/app/degree-planner/degree-planner.component.ts +++ b/src/app/degree-planner/degree-planner.component.ts @@ -235,6 +235,10 @@ export class DegreePlannerComponent implements OnInit, OnDestroy { public closeCourseSearch() { this.store.dispatch(new CloseCourseSearch()); } + + public trackYearCodes(_index: number, yearCode: YearCode) { + return yearCode.toString(); + } } const isntUndefined = <T>(anything: T | undefined): anything is T => { -- GitLab