From 30823b424d553c0a12b947490d90dbf39be2c508 Mon Sep 17 00:00:00 2001 From: Teigen Date: Wed, 25 Mar 2026 20:27:48 +0800 Subject: [PATCH] fix: case selection not persisting across page refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit saveLastUsedCase() was GET-ing the full settings object and PUT-ing it back. The settings contained `modelConfig` which is not in the strict SettingsUpdateSchema, causing a 400 rejection. Now sends only the `lastUsedCase` field — the backend already merges partial updates. --- src/web/public/session-ui.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/web/public/session-ui.js b/src/web/public/session-ui.js index bf5e287c..260956e7 100644 --- a/src/web/public/session-ui.js +++ b/src/web/public/session-ui.js @@ -109,16 +109,10 @@ Object.assign(CodemanApp.prototype, { async saveLastUsedCase(caseName) { 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', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(settings) + body: JSON.stringify({ lastUsedCase: caseName }) }); } catch (err) { console.error('Failed to save last used case:', err);