Skip to content

fix: prevent save button from becoming inactive in Modes settings#12285

Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
fix/modes-save-button-inactive-12283
Draft

fix: prevent save button from becoming inactive in Modes settings#12285
roomote-v0[bot] wants to merge 1 commit intomainfrom
fix/modes-save-button-inactive-12283

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 Bot commented May 7, 2026

Related GitHub Issue

Closes: #12283

Description

This PR attempts to address Issue #12283 where the Save button becomes inactive after changing the API Configuration in Settings -> Modes, and API config bleeds across modes.

Root cause: The ModesView API config selector called loadApiConfiguration directly, bypassing the checkUnsaveChanges guard used elsewhere in SettingsView. This caused the backend to update state immediately, which triggered a sync effect that reset cachedState and set isChangeDetected = false, making the Save button inactive. Additionally, handleModeSwitch auto-saved the current API config as the default for any mode that did not already have one, causing config bleed.

Changes:

  • ModesView.tsx: Added checkUnsaveChanges prop and wrapped the API config loadApiConfiguration call so users are prompted about unsaved changes before switching profiles (consistent with the Providers tab behavior).
  • SettingsView.tsx: Passed checkUnsaveChanges callback to ModesView.
  • ClineProvider.ts: Removed auto-save of current config when switching to a mode without a saved config. Modes without an explicit config association now simply use whatever config is currently active, without persisting the association.
  • ClineProvider.spec.ts: Updated two tests to reflect the new behavior (no auto-save).

Feedback and guidance are welcome.

Test Procedure

  • Existing tests updated and all pass: npx vitest run for ClineProvider.spec.ts, ClineProvider.sticky-mode.spec.ts, ClineProvider.lockApiConfig.spec.ts (108 passed, 6 skipped).
  • Manual test: Open Settings -> Modes, change the API Configuration dropdown. If there are unsaved changes in settings, a discard dialog should appear. Switching modes should no longer auto-save the current API config as the new mode's default.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue.
  • Scope: Changes are focused on the linked issue.
  • Self-Review: Performed a self-review of the code.
  • Testing: Updated existing tests to cover changed behavior.
  • Documentation Impact: No documentation updates required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This is an automated attempt at fixing the issue based on the analysis in the issue thread. Maintainer review is appreciated.

Interactively review PR in Roo Code Cloud

…2283)

- Pass checkUnsaveChanges from SettingsView to ModesView so API config
  changes in the Modes tab prompt for unsaved changes before applying
- Remove auto-save of current config when switching to a mode without
  a saved config, preventing config bleed across modes
- Update tests to match new behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Save button inactive after change in Settings -> Modes -> [Mode change]

1 participant