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 065e50f commit 1bce039
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/frontend/app/components/pending-updates-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import Component from '@glimmer/component';
import { service } from '@ember/service';
import { cached, tracked } from '@glimmer/tracking';
import { filter } from 'rsvp';
import { use } from 'ember-could-get-used-to-this';
import { TrackedAsyncData } from 'ember-async-data';
import AsyncProcess from 'ilios-common/classes/async-process';
import { findById } from 'ilios-common/utils/array-helpers';

export default class PendingUpdatesSummaryComponent extends Component {
Expand Down Expand Up @@ -34,11 +32,16 @@ export default class PendingUpdatesSummaryComponent extends Component {
return this.allUpdatesData.isResolved ? this.allUpdatesData.value : null;
}

@use updatesForSchool = new AsyncProcess(() => [
this.getUpdatesForSchool,
this.allUpdatesArray,
this.bestSelectedSchool,
]);
@cached
get updatesData() {
return new TrackedAsyncData(
this.getUpdatesForSchool(this.allUpdatesArray, this.bestSelectedSchool),
);
}

get updates() {
return this.updatesData.isResolved ? this.updatesData.value : [];
}

get haveUpdates() {
return this.updates?.length > 0;
Expand Down Expand Up @@ -67,10 +70,6 @@ export default class PendingUpdatesSummaryComponent extends Component {
return this.allUpdates.slice();
}

get updates() {
return this.updatesForSchool ?? [];
}

async getUpdatesForSchool(allUpdates, selectedSchool) {
return filter(allUpdates.slice(), async (update) => {
const user = await update.user;
Expand Down

0 comments on commit 1bce039

Please sign in to comment.