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.
ci / server (push) Failing after 3m40s
ci / client (push) Failing after 13s

This commit is contained in:
Leonid Pershin
2026-08-20 04:15:41 +03:00
parent dfa9a25dca
commit 03378793be
@@ -67,7 +67,6 @@ export class ApplicantsDialog {
private selectedId: string | null; private selectedId: string | null;
private sort: ApplicantSort = 'name'; private sort: ApplicantSort = 'name';
private dir: 'asc' | 'desc' = 'asc'; private dir: 'asc' | 'desc' = 'asc';
private cardToken = 0;
private busy = false; private busy = false;
private readonly cardHost = new PersonCardHost(); private readonly cardHost = new PersonCardHost();
private painted: PersonCard | null = null; private painted: PersonCard | null = null;
@@ -294,16 +293,15 @@ export class ApplicantsDialog {
} }
private async openCard(personId: string): Promise<void> { private async openCard(personId: string): Promise<void> {
const token = ++this.cardToken;
try { try {
const card = await fetchPerson(this.options.schoolId, personId, getLocale()); const card = await fetchPerson(this.options.schoolId, personId, getLocale());
if (token !== this.cardToken) { if (personId !== this.selectedId) {
return; return;
} }
this.paintCard(card); this.paintCard(card);
} catch { } catch {
if (token !== this.cardToken) { if (personId !== this.selectedId) {
return; return;
} }