Problem
After SystemSection.handleChangeWorkspace successfully changes the workspace, it updates workspacePath in local state and shows a toast, but the renderer's Zustand stores (task store, message store, agent catalog, etc.) still contain data from the old workspace. The main process has already called reinitDatabase(newPath) and is reading from a different SQLite file, so the renderer's cached task list, messages, and artifacts no longer correspond to anything in the new DB. Users have to manually refresh or relaunch to see the real contents of the new workspace — and the UI gives them no hint that this is needed.
Location
File: packages/desktop/src/renderer/layouts/Settings/sections/SystemSection.tsx:62-78
const handleChangeWorkspace = useCallback(async () => {
const selected = await window.clawwork.browseWorkspace();
if (!selected || selected === workspacePath) return;
const oldPath = workspacePath;
setChangingWorkspace(true);
const result = await window.clawwork.changeWorkspace(selected);
setChangingWorkspace(false);
if (result.ok) {
setWorkspacePath(selected);
toast.success(t('settings.workspaceChanged'), {
description: t('settings.workspaceOldPathHint', { path: oldPath }),
duration: 8000,
});
}
// ...
}, [workspacePath, t]);
Fix Approach
Pick one of, in order of increasing invasiveness:
- Minimum: change the success toast to clearly state that a restart is required to view the new workspace, and add an "Action: Restart" button that calls
window.clawwork.relaunch() (if such an IPC exists, otherwise offer a manual-restart explanation).
- Better: emit an IPC event from the main process (e.g.
workspace:changed) that the renderer subscribes to; on receipt, clear all Zustand stores and re-run the bootstrap flow.
- Best: combine both — cleanly re-hydrate in place, but also toast with a subtle "restart if you see stale data" escape hatch for edge cases.
Verification
- Run
pnpm check — must pass.
- Manual: change workspace to a directory that already has a different task list; confirm either the task list refreshes in place, or the UI clearly prompts the user to restart.
Context
- WG: UI & Design System (also touches Task & Session Core)
- Priority: Low
- Estimated effort: 30-45 minutes (if going for option 2)
Problem
After
SystemSection.handleChangeWorkspacesuccessfully changes the workspace, it updatesworkspacePathin local state and shows a toast, but the renderer's Zustand stores (task store, message store, agent catalog, etc.) still contain data from the old workspace. The main process has already calledreinitDatabase(newPath)and is reading from a different SQLite file, so the renderer's cached task list, messages, and artifacts no longer correspond to anything in the new DB. Users have to manually refresh or relaunch to see the real contents of the new workspace — and the UI gives them no hint that this is needed.Location
File:
packages/desktop/src/renderer/layouts/Settings/sections/SystemSection.tsx:62-78Fix Approach
Pick one of, in order of increasing invasiveness:
window.clawwork.relaunch()(if such an IPC exists, otherwise offer a manual-restart explanation).workspace:changed) that the renderer subscribes to; on receipt, clear all Zustand stores and re-run the bootstrap flow.Verification
pnpm check— must pass.Context