Skip to content

Commit 667b454

Browse files
committed
fix: unify legacy claudeCode migration across both settings read paths
1 parent cf638c6 commit 667b454

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

apps/web/src/appSettings.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback } from "react";
1+
import { useCallback, useMemo } from "react";
22
import { Option, Schema } from "effect";
33
import {
44
DEFAULT_GIT_TEXT_GENERATION_MODEL_BY_PROVIDER,
@@ -454,6 +454,21 @@ export function useAppSettings() {
454454
AppSettingsSchema,
455455
);
456456

457+
// Apply legacy key migration that the schema decode path doesn't handle
458+
// (e.g. gitTextGenerationModelByProvider.claudeCode → claudeAgent).
459+
const migratedSettings = useMemo(() => {
460+
const git = settings.gitTextGenerationModelByProvider;
461+
if (git && typeof git === "object" && "claudeCode" in git) {
462+
const record = { ...git } as Record<string, string>;
463+
if (typeof record.claudeAgent !== "string" && typeof record.claudeCode === "string") {
464+
record.claudeAgent = record.claudeCode;
465+
}
466+
delete record.claudeCode;
467+
return { ...settings, gitTextGenerationModelByProvider: record };
468+
}
469+
return settings;
470+
}, [settings]);
471+
457472
const updateSettings = useCallback(
458473
(patch: Partial<AppSettings>) => {
459474
setSettings((prev) => normalizeAppSettings({ ...prev, ...patch }));
@@ -466,7 +481,7 @@ export function useAppSettings() {
466481
}, [setSettings]);
467482

468483
return {
469-
settings,
484+
settings: migratedSettings,
470485
updateSettings,
471486
resetSettings,
472487
defaults: DEFAULT_APP_SETTINGS,

0 commit comments

Comments
 (0)