mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Fix model search being prefilled on dropdown (#5449)
This commit is contained in:
parent
7d31966978
commit
36b3cdc833
2 changed files with 19 additions and 17 deletions
5
.changeset/large-olives-wink.md
Normal file
5
.changeset/large-olives-wink.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Fix model search being prefilled in dropdown to prevent confusion in available models
|
||||
|
|
@ -70,7 +70,7 @@ export const ModelPicker = ({
|
|||
|
||||
const { id: selectedModelId, info: selectedModelInfo } = useSelectedModel(apiConfiguration)
|
||||
|
||||
const [searchValue, setSearchValue] = useState(selectedModelId || "")
|
||||
const [searchValue, setSearchValue] = useState("")
|
||||
|
||||
const onSelect = useCallback(
|
||||
(modelId: string) => {
|
||||
|
|
@ -87,28 +87,25 @@ export const ModelPicker = ({
|
|||
}
|
||||
|
||||
// Delay to ensure the popover is closed before setting the search value.
|
||||
selectTimeoutRef.current = setTimeout(() => setSearchValue(modelId), 100)
|
||||
selectTimeoutRef.current = setTimeout(() => setSearchValue(""), 100)
|
||||
},
|
||||
[modelIdKey, setApiConfigurationField],
|
||||
)
|
||||
|
||||
const onOpenChange = useCallback(
|
||||
(open: boolean) => {
|
||||
setOpen(open)
|
||||
const onOpenChange = useCallback((open: boolean) => {
|
||||
setOpen(open)
|
||||
|
||||
// Abandon the current search if the popover is closed.
|
||||
if (!open) {
|
||||
// Clear any existing timeout
|
||||
if (closeTimeoutRef.current) {
|
||||
clearTimeout(closeTimeoutRef.current)
|
||||
}
|
||||
|
||||
// Delay to ensure the popover is closed before setting the search value.
|
||||
closeTimeoutRef.current = setTimeout(() => setSearchValue(selectedModelId), 100)
|
||||
// Abandon the current search if the popover is closed.
|
||||
if (!open) {
|
||||
// Clear any existing timeout
|
||||
if (closeTimeoutRef.current) {
|
||||
clearTimeout(closeTimeoutRef.current)
|
||||
}
|
||||
},
|
||||
[selectedModelId],
|
||||
)
|
||||
|
||||
// Clear the search value when closing instead of prefilling it
|
||||
closeTimeoutRef.current = setTimeout(() => setSearchValue(""), 100)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const onClearSearch = useCallback(() => {
|
||||
setSearchValue("")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue