mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: prevent unnecessary change detection in OpenAI Compatible settings
- Added comparison check before updating openAiHeaders to prevent triggering change detection when headers haven't actually changed - This fixes the issue where the Save button was always highlighted when using OpenAI Compatible provider with a base URL Fixes #6151
This commit is contained in:
parent
1e17b3b3bb
commit
01b6630328
1 changed files with 8 additions and 3 deletions
|
|
@ -87,12 +87,17 @@ export const OpenAICompatible = ({
|
|||
// Add effect to update the parent component's state when local headers change
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
const headerObject = convertHeadersToObject(customHeaders)
|
||||
setApiConfigurationField("openAiHeaders", headerObject)
|
||||
const currentConfigHeaders = apiConfiguration?.openAiHeaders || {}
|
||||
const newHeadersObject = convertHeadersToObject(customHeaders)
|
||||
|
||||
// Only update if the processed object is different from the current config
|
||||
if (JSON.stringify(currentConfigHeaders) !== JSON.stringify(newHeadersObject)) {
|
||||
setApiConfigurationField("openAiHeaders", newHeadersObject)
|
||||
}
|
||||
}, 300)
|
||||
|
||||
return () => clearTimeout(timer)
|
||||
}, [customHeaders, setApiConfigurationField])
|
||||
}, [customHeaders, apiConfiguration?.openAiHeaders, setApiConfigurationField])
|
||||
|
||||
const handleInputChange = useCallback(
|
||||
<K extends keyof ProviderSettings, E>(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue