Skip to content

Commit

Permalink
replace AsyncProcess with TrackedAsyncData equivalent.
Browse files Browse the repository at this point in the history
  • Loading branch information
stopfstedt committed Jul 3, 2024
1 parent 9399538 commit db02ee7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/frontend/app/components/courses/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import Component from '@glimmer/component';
import { service } from '@ember/service';
import { dropTask } from 'ember-concurrency';
import { DateTime } from 'luxon';
import { use } from 'ember-could-get-used-to-this';
import { TrackedAsyncData } from 'ember-async-data';
import { cached, tracked } from '@glimmer/tracking';
import AsyncProcess from 'ilios-common/classes/async-process';
import { findById } from 'ilios-common/utils/array-helpers';
import { action } from '@ember/object';

Expand All @@ -21,11 +19,17 @@ export default class CoursesRootComponent extends Component {
@tracked sortSchoolsBy = null;
@tracked sortYearsBy = null;

@use preloadedCoursesInSelectedSchool = new AsyncProcess(() => [
this.getCourses,
this.selectedSchool,
this.dataLoader,
]);
@cached
get preloadedCoursesInSelectedSchoolData() {
return new TrackedAsyncData(this.getCourses(this.selectedSchool, this.dataLoader));
}

get preloadedCoursesInSelectedSchool() {
return this.preloadedCoursesInSelectedSchoolData.isResolved
? this.preloadedCoursesInSelectedSchoolData.value
: false;
}

userModelData = new TrackedAsyncData(this.currentUser.getModel());
crossesBoundaryConfig = new TrackedAsyncData(
this.iliosConfig.itemFromConfig('academicYearCrossesCalendarYearBoundaries'),
Expand Down

0 comments on commit db02ee7

Please sign in to comment.