From 51a14ad975efbc3b021075d499f3ccf230bbf0f3 Mon Sep 17 00:00:00 2001 From: Yared Yemane Date: Tue, 7 Apr 2026 09:35:14 -0700 Subject: [PATCH] practice questions fix --- src/pages/content-management/HumanLanguagePage.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pages/content-management/HumanLanguagePage.tsx b/src/pages/content-management/HumanLanguagePage.tsx index 0dd300d..8e46362 100644 --- a/src/pages/content-management/HumanLanguagePage.tsx +++ b/src/pages/content-management/HumanLanguagePage.tsx @@ -480,14 +480,13 @@ export function HumanLanguagePage() { } const togglePracticeCard = (smKey: string, practiceId: number) => { - let openedPracticeId: number | null = null + const currentPracticeId = subModuleCardSelection[smKey]?.practiceId ?? null + const nextPracticeId = currentPracticeId === practiceId ? null : practiceId setSubModuleCardSelection((prev) => { const cur = prev[smKey] ?? { lessonId: null, practiceId: null } - const nextPracticeId = cur.practiceId === practiceId ? null : practiceId - if (nextPracticeId !== null) openedPracticeId = nextPracticeId return { ...prev, [smKey]: { ...cur, practiceId: nextPracticeId } } }) - if (openedPracticeId !== null) void loadPracticeQuestionsIfNeeded(openedPracticeId) + if (nextPracticeId !== null) void loadPracticeQuestionsIfNeeded(nextPracticeId) } return (