fix: prevent false unsaved changes prompt with OpenAI Compatible headers (#8230) #11334
+22
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #8230
Description
Picks up the fix from #11300 by @robertjmcintyre (without the unrelated Windows test changes).
Root Cause
Automatic header synchronization in the OpenAI Compatible provider settings causes a false dirty state. Two separate components (
ApiOptionsandOpenAICompatible) manageopenAiHeadersstate and automatically sync it back to the configuration. When components mount/remount:customHeadersstate initializes with a new array/object reference (even if content is identical)setApiConfigurationField("openAiHeaders", ...)without marking them as non-user actionsSolution
Three changes fix this issue:
isUserAction: false)areValuesEqualhelper)Credit
Original fix by @robertjmcintyre in #11300.
Test Procedure
All existing tests pass (300 webview-ui settings tests, 5314 roo-cline tests).
Pre-Submission Checklist
Important
Fix false unsaved changes prompt by marking automatic header syncs as non-user actions and enhancing change detection logic in OpenAI Compatible settings.
ApiOptions.tsxandOpenAICompatible.tsx.SettingsView.tsxto skip automatic syncs with semantically equal values usingareValuesEqualhelper.setApiConfigurationFieldinApiOptions.tsxandOpenAICompatible.tsxto includeisUserAction: falsefor automatic syncs.areValuesEqualhelper inSettingsView.tsxto compare values semantically.This description was created by
for 6433d65. You can customize this summary. It will automatically update as commits are pushed.