mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: prevent IO Intelligence model picker from reverting selection
The ModelPicker component was incorrectly reinitializing the model selection when selectedModelId was falsy (empty string or undefined). This caused the IO Intelligence model picker to revert to the default model. Fixed by checking if the field is truly uninitialized (undefined) rather than just falsy, preventing unwanted reinitialization of already-set values. Fixes #7991
This commit is contained in:
parent
9d33c109c9
commit
ac5204fcb0
1 changed files with 4 additions and 3 deletions
|
|
@ -126,13 +126,14 @@ export const ModelPicker = ({
|
|||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedModelId && !isInitialized.current) {
|
||||
const initialValue = modelIds.includes(selectedModelId) ? selectedModelId : defaultModelId
|
||||
// Only initialize if the field has never been set (undefined), not when it's an empty string
|
||||
if (apiConfiguration[modelIdKey] === undefined && !isInitialized.current) {
|
||||
const initialValue = defaultModelId
|
||||
setApiConfigurationField(modelIdKey, initialValue, false) // false = automatic initialization
|
||||
}
|
||||
|
||||
isInitialized.current = true
|
||||
}, [modelIds, setApiConfigurationField, modelIdKey, selectedModelId, defaultModelId])
|
||||
}, [modelIds, setApiConfigurationField, modelIdKey, apiConfiguration, defaultModelId])
|
||||
|
||||
// Cleanup timeouts on unmount to prevent test flakiness
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue