Problem
window.clawwork.getSettings() is called independently in 4 separate files, each fetching and parsing the full settings object on mount. There is no centralized cache — settings changes in one component do not propagate to others.
Location
Files:
packages/desktop/src/renderer/App.tsx:91 — reads sendShortcut, leftNavShortcut, rightPanelShortcut, devMode
packages/desktop/src/renderer/layouts/Settings/sections/GeneralSection.tsx:88 — reads notifications
packages/desktop/src/renderer/layouts/Settings/sections/SystemSection.tsx:26 — reads quickLaunch settings
packages/desktop/src/renderer/layouts/Settings/components/PairMobileDialog.tsx:71 — reads gateways config
Each component does:
useEffect(() => {
window.clawwork.getSettings().then((settings) => {
if (!settings) return;
// parse specific fields...
});
}, []);
Fix Approach
Create useSettingsStore (Zustand):
export const useSettingsStore = create<SettingsState>((set, get) => ({
settings: null,
loaded: false,
load: async () => {
const s = await window.clawwork.getSettings();
set({ settings: s, loaded: true });
},
update: async (patch) => {
await window.clawwork.updateSettings(patch);
set((state) => ({ settings: { ...state.settings!, ...patch } }));
},
}));
- Call
load() once in App.tsx on startup
- Components read via selector:
useSettingsStore((s) => s.settings?.notifications)
- Mutations via
update() propagate to all consumers
Verification
- Run
pnpm check — must pass
- Change a setting, verify it takes effect immediately in all sections
Context
- WG: UI & Design System
- Priority: Medium
- Estimated effort: ~1 hour
Problem
window.clawwork.getSettings()is called independently in 4 separate files, each fetching and parsing the full settings object on mount. There is no centralized cache — settings changes in one component do not propagate to others.Location
Files:
packages/desktop/src/renderer/App.tsx:91— readssendShortcut,leftNavShortcut,rightPanelShortcut,devModepackages/desktop/src/renderer/layouts/Settings/sections/GeneralSection.tsx:88— readsnotificationspackages/desktop/src/renderer/layouts/Settings/sections/SystemSection.tsx:26— readsquickLaunchsettingspackages/desktop/src/renderer/layouts/Settings/components/PairMobileDialog.tsx:71— readsgatewaysconfigEach component does:
Fix Approach
Create
useSettingsStore(Zustand):load()once inApp.tsxon startupuseSettingsStore((s) => s.settings?.notifications)update()propagate to all consumersVerification
pnpm check— must passContext