Skip to content

Commit

Permalink
replaces read-only tracked prop courses with getter.
Browse files Browse the repository at this point in the history
  • Loading branch information
stopfstedt committed Dec 20, 2024
1 parent 5d35fda commit 33af894
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/frontend/app/components/learner-group/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default class LearnerGroupRootComponent extends Component {
@tracked location = null;
@IsURL() @Length(2, 2000) @tracked url = null;
@tracked showLearnerGroupCalendar = false;
@tracked courses = [];
@tracked usersToPassToManager = [];
@tracked usersToPassToCohortManager = [];
@tracked sortGroupsBy = 'title';
Expand All @@ -44,7 +43,6 @@ export default class LearnerGroupRootComponent extends Component {
if (isPresent(learnerGroup)) {
this.usersToPassToManager = await this.createUsersToPassToManager.perform();
this.usersToPassToCohortManager = await this.createUsersToPassToCohortManager.perform();
this.courses = await this.getCoursesForGroupWithSubgroupName(null, this.args.learnerGroup);
}
});

Expand All @@ -57,6 +55,17 @@ export default class LearnerGroupRootComponent extends Component {
return this.args.learnerGroup.title;
}

@cached
get coursesData() {
return new TrackedAsyncData(
this.getCoursesForGroupWithSubgroupName(null, this.args.learnerGroup),
);
}

get courses() {
return this.coursesData.isResolved ? this.coursesData.value : [];
}

@cached
get cohortData() {
return new TrackedAsyncData(this.args.learnerGroup.cohort);
Expand Down

0 comments on commit 33af894

Please sign in to comment.