Save Button Disappears and Directory Is Saved Unexpectedly - cc-switch
Quick fix
Make autosave submit only persisted directory values and preserve unsaved directory drafts during settings refreshes and concurrent saves.
Symptom
Section titled “Symptom”The successful mutation refetch makes the path look saved and removes its **Save** button, even though the directory-specific Save flow was never invoked.`useSettings.autoSaveSettings()` puts the entire draft form into the payload submitted to `settingsApi.save()`. Therefore, toggling an unrelated preference such as `Show profile switcher` also writes a configuration directory whose **Save** button has not been clicked.
The refetch after a successful save makes the new path appear saved and removes the **Save** button. Resetting an existing override to its default has the same problem: the next autosave of an unrelated preference deletes the persisted override.
Change the immediate autosave logic so its payload uses persisted values for configuration directories instead of the current unsaved draft values.
Preserve dirty configuration-directory drafts after query refreshes so a successful mutation's refetch does not incorrectly treat them as saved.
Handle overlapping directory Save and preference toggle operations, and cover all eight directory fields, repeated autosaves, explicit Save, reset to defaults, cancel or revert, save or refetch failures, and interrupted Save in tests.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- Can resetting an existing configuration-directory override to its default also be submitted unexpectedly by autosaving an unrelated setting?
- Yes. The issue reproduction shows that the next save of an unrelated preference removes the persisted override.
- Are directory changes submitted without clicking Save when the page is canceled, reverted, or unmounted?
- The issue's baseline tests show that the cancel, revert, and unmount-without-saving control cases pass; autosaving another preference triggers the problem.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.