fix(worksheets): persist digitRange and manualPreset in auto-save

Added missing V4 fields to auto-save hook:
- digitRange (min/max digit configuration)
- manualPreset (manual mode preset selection)

These fields were already in the form state but weren't being saved
to the server, causing settings to not persist across sessions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-11-07 22:09:08 -06:00
parent 130bbd49dd
commit c87499535a

View File

@@ -14,6 +14,7 @@ interface UseWorksheetAutoSaveReturn {
* Features:
* - Debounced auto-save (1000ms delay)
* - Only persists settings, not transient state (date, seed, rows, total)
* - Persists V4 fields: mode, digitRange, displayRules, difficultyProfile, manualPreset
* - Silent error handling (auto-save is not critical)
* - StrictMode-safe (handles double renders)
*/
@@ -50,6 +51,7 @@ export function useWorksheetAutoSave(
pages,
orientation,
name,
digitRange,
pAnyStart,
pAllStart,
interpolate,
@@ -64,6 +66,7 @@ export function useWorksheetAutoSave(
mode,
difficultyProfile,
displayRules,
manualPreset,
} = formState
const response = await fetch('/api/worksheets/settings', {
@@ -77,6 +80,7 @@ export function useWorksheetAutoSave(
pages,
orientation,
name,
digitRange,
pAnyStart,
pAllStart,
interpolate,
@@ -91,6 +95,7 @@ export function useWorksheetAutoSave(
mode,
difficultyProfile,
displayRules,
manualPreset,
},
}),
})