fix: case selection not persisting across page refresh (#49)

Thank you for the clean fix! The root cause analysis in the PR description was excellent — the strict Zod schema rejecting modelConfig during the GET-then-PUT pattern was a subtle bug.
This commit is contained in:
Tenggan Zhang
2026-03-25 13:39:16 +01:00
committed by GitHub
parent 82d08df53f
commit 52e774f83c
+1 -7
View File
@@ -109,16 +109,10 @@ Object.assign(CodemanApp.prototype, {
async saveLastUsedCase(caseName) { async saveLastUsedCase(caseName) {
try { try {
// Get current settings
const res = await fetch('/api/settings');
const settings = res.ok ? await res.json() : {};
// Update lastUsedCase
settings.lastUsedCase = caseName;
// Save back
await fetch('/api/settings', { await fetch('/api/settings', {
method: 'PUT', method: 'PUT',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(settings) body: JSON.stringify({ lastUsedCase: caseName })
}); });
} catch (err) { } catch (err) {
console.error('Failed to save last used case:', err); console.error('Failed to save last used case:', err);