Skip to content

Commit ffb42ca

Browse files
committed
fix: preventing dirty state for Gemini naming convention migration
1 parent 9a1bc43 commit ffb42ca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
} from "lucide-react"
2727

2828
import type { ProviderSettings, ExperimentId } from "@roo-code/types"
29+
import { mapLegacyGeminiModel, mapLegacyVertexModel } from "@roo-code/types"
2930

3031
import { TelemetrySetting } from "@roo/TelemetrySetting"
3132

@@ -231,7 +232,17 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
231232
// This prevents the dirty state when the component initializes and auto-syncs the model ID
232233
const isInitialSync = previousValue === undefined && value !== undefined
233234

234-
if (!isInitialSync) {
235+
let isLegacyGeminiMapping = false
236+
if (field === "apiModelId" && typeof previousValue === "string" && typeof value === "string") {
237+
const provider = prevState.apiConfiguration?.apiProvider
238+
if (provider === "gemini") {
239+
isLegacyGeminiMapping = mapLegacyGeminiModel(previousValue) === value
240+
} else if (provider === "vertex") {
241+
isLegacyGeminiMapping = mapLegacyVertexModel(previousValue) === value
242+
}
243+
}
244+
245+
if (!isInitialSync && !isLegacyGeminiMapping) {
235246
setChangeDetected(true)
236247
}
237248
return { ...prevState, apiConfiguration: { ...prevState.apiConfiguration, [field]: value } }

0 commit comments

Comments
 (0)