From 88e929ed6374f954c64a720f84e166a3ce94f386 Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Fri, 7 Nov 2025 13:55:42 -0600 Subject: [PATCH] fix(worksheets): prevent wrong preset showing as active at custom positions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix preset button highlighting to not default to 'earlyLearner' when at a custom difficulty position between presets. Before: When between Intermediate and Advanced, Early Learner button would incorrectly show as selected. After: No preset button is highlighted when at a custom position. The profile variable still defaults to earlyLearner for fallback values, but currentProfile remains undefined so isSelected checks work correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../create/worksheets/addition/components/ConfigPanel.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx b/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx index 4c87b2a0..1b951b0c 100644 --- a/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx +++ b/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx @@ -639,9 +639,10 @@ export function ConfigPanel({ formState, onChange }: ConfigPanelProps) { {/* Get current profile and state */} {(() => { - const currentProfile = (formState.difficultyProfile || - 'earlyLearner') as DifficultyLevel - const profile = DIFFICULTY_PROFILES[currentProfile] + const currentProfile = formState.difficultyProfile as DifficultyLevel | undefined + const profile = currentProfile + ? DIFFICULTY_PROFILES[currentProfile] + : DIFFICULTY_PROFILES.earlyLearner // Use defaults from profile if form state values are undefined const pAnyStart = formState.pAnyStart ?? profile.regrouping.pAnyStart