Refactor ApplicantsDialog to remove unused cardToken and improve card fetching logic. Updated openCard method to check against selectedId instead of cardToken for better state management.
This commit is contained in:
@@ -67,7 +67,6 @@ export class ApplicantsDialog {
|
||||
private selectedId: string | null;
|
||||
private sort: ApplicantSort = 'name';
|
||||
private dir: 'asc' | 'desc' = 'asc';
|
||||
private cardToken = 0;
|
||||
private busy = false;
|
||||
private readonly cardHost = new PersonCardHost();
|
||||
private painted: PersonCard | null = null;
|
||||
@@ -294,16 +293,15 @@ export class ApplicantsDialog {
|
||||
}
|
||||
|
||||
private async openCard(personId: string): Promise<void> {
|
||||
const token = ++this.cardToken;
|
||||
try {
|
||||
const card = await fetchPerson(this.options.schoolId, personId, getLocale());
|
||||
if (token !== this.cardToken) {
|
||||
if (personId !== this.selectedId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.paintCard(card);
|
||||
} catch {
|
||||
if (token !== this.cardToken) {
|
||||
if (personId !== this.selectedId) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user