Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion webview-ui/src/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t

// Don't treat initial sync from undefined to a defined value as a user change
// This prevents the dirty state when the component initializes and auto-syncs the model ID
const isInitialSync = previousValue === undefined && value !== undefined
// Exception: enableReasoningEffort is a user-controlled checkbox that should always trigger changes
const isInitialSync =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this approach intentional? Hard-coding field names here creates a maintenance burden. Could we consider using a more maintainable pattern like:

Suggested change
const isInitialSync =
// Don't treat initial sync from undefined to a defined value as a user change
// This prevents the dirty state when the component initializes and auto-syncs the model ID
// Exception: user-controlled checkboxes that should always trigger changes
const USER_CONTROLLED_FIELDS = new Set(['enableReasoningEffort'])
const isInitialSync =
previousValue === undefined && value !== undefined && !USER_CONTROLLED_FIELDS.has(field)

previousValue === undefined && value !== undefined && field !== "enableReasoningEffort"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fix works for enableReasoningEffort, I found several other checkbox fields that might suffer from the same undefined → true transition issue:

  • anthropicBeta1MContext
  • awsBedrock1MContext
  • enableUrlContext
  • enableGrounding
  • lmStudioSpeculativeDecodingEnabled
  • openAiLegacyFormat

Should we investigate if these need the same treatment? Or perhaps consider a more scalable solution like maintaining a Set of user-controlled fields?


if (!isInitialSync) {
setChangeDetected(true)
Expand Down
Loading