fix: prevent save button from becoming inactive in Modes settings#12285
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: prevent save button from becoming inactive in Modes settings#12285roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: #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
loadApiConfigurationdirectly, bypassing thecheckUnsaveChangesguard used elsewhere in SettingsView. This caused the backend to update state immediately, which triggered a sync effect that resetcachedStateand setisChangeDetected = false, making the Save button inactive. Additionally,handleModeSwitchauto-saved the current API config as the default for any mode that did not already have one, causing config bleed.Changes:
ModesView.tsx: AddedcheckUnsaveChangesprop and wrapped the API configloadApiConfigurationcall so users are prompted about unsaved changes before switching profiles (consistent with the Providers tab behavior).SettingsView.tsx: PassedcheckUnsaveChangescallback toModesView.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
npx vitest runfor ClineProvider.spec.ts, ClineProvider.sticky-mode.spec.ts, ClineProvider.lockApiConfig.spec.ts (108 passed, 6 skipped).Pre-Submission Checklist
Documentation Updates
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