fix: add save button to settings page with draft mode#77
Conversation
- Convert settings controls to draft mode: changes only update local state, not persisted until user clicks save - Add saveSettings() batch persist method to settingsStore - Make all setters synchronous (no individual config.update calls) - Add save button with loading state to Appearance, General, DataManagement tabs - Add i18n keys: save, saving, saveSuccess, saveFailed (zh-CN + en-US) - requestLogConfig remains immediate-save (by design) Closes xiaoY233#76
Merged PRs from xiaoY233/Chat2API: - xiaoY233#74: DeepSeek V4 Pro/Flash model support - xiaoY233#92: Credential encryption toggle - xiaoY233#93: Kimi K2.6 upgrade - xiaoY233#84: Account weight-based load balancing - xiaoY233#83: Qwen silent content drop fix - xiaoY233#85: data.json performance optimization (log buffering) - xiaoY233#87: Multi-turn conversation session reuse - xiaoY233#77: Settings page draft mode with save button - xiaoY233#106: Qwen context loss fix (messagesToPrompt)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 481dc48f5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| setLanguage: (language) => { | ||
| set({ language }) | ||
| await i18n.changeLanguage(language) | ||
| try { | ||
| await window.electronAPI.config.update({ language: language }) | ||
| } catch (error) { | ||
| console.error('Failed to update language:', error) | ||
| } | ||
| i18n.changeLanguage(language) |
There was a problem hiding this comment.
Persist header language changes to main config
When users switch languages from the header (Header.tsx calls setLanguage directly), this setter now only updates Zustand/i18n and no longer writes the Electron config. Because the Settings page calls fetchConfig() and overwrites language from the main config, a header-only language change is reverted the next time that page is opened (and can also be lost across flows that reload config). Keep the direct setter persistent or add a separate draft-only setter for the Appearance form.
Useful? React with 👍 / 👎.
Summary
Fixes #76 — settings page changes were not always persisting correctly with the instant-save approach. This PR converts settings controls to draft mode with an explicit save button.
Changes
saveSettings()batches and persists to backendsave,saving,saveSuccess,saveFailedkeys (zh-CN + en-US)How it works
useStatedraft onlysaveSettings()to persist viawindow.electronAPI.config.update()Closes #76