clawwork-ai / clawwork-ai/ClawWork
[Bug] SystemSection handleChangeWorkspace button stuck spinning on IPC error
- Dominant language
- TypeScript
- Stars
- 532
- Forks
- 75
- Avg merge
- 5h 31m
- Merged PRs (30d)
- 1
Description
## Problem
`SystemSection.handleChangeWorkspace` calls `setChangingWorkspace(true)` → `await window.clawwork.changeWorkspace(selected)` → `setChangingWorkspace(false)` without a `try/catch`. If the IPC throws (workspace migration exception, invalid path, disk error), the final state reset never runs and the "Change Workspace" button is stuck showing a spinner until the user closes Settings.
## Location
**File:** `packages/desktop/src/renderer/layouts/Settings/sections/SystemSection.tsx:62-78`
```typescript
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); // throw → stuck
setChangingWorkspace(false);
if (result.ok) {
// ...
} else {
toast.error(t('settings.workspaceChangeFailed', { error: result.error }));
}
}, [workspacePath, t]);
```
## Fix Approach
Wrap the body in `try/finally`:
```typescript
setChangingWorkspace(true);
try {
const result = await window.clawwork.changeWorkspace(selected);
if (result.ok) {
setWorkspacePath(selected);
toast.success(...);
} else {
toast.error(t('settings.workspaceChangeFailed', { error: result.error }));
}
} catch (err) {
console.error('[SystemSection] changeWorkspace failed:', err);
toast.error(t('settings.workspaceChangeFailed', { error: String(err) }));
} finally {
setChangingWorkspace(false);
}
```
Consider also wrapping `browseWorkspace` for consistency.
## Verification
1. Run `pnpm check` — must pass.
2. Manual: simulate IPC failure during workspace change — button must return to idle state.
## Context
- **WG:** UI & Design System
- **Priority:** Low (good first issue)
- **Estimated effort:** 10-15 minutes
Contributor guide
Research direction
Start in packages/desktop/src/renderer/layouts/Settings/sections/SystemSection.tsx:62-78 and inspect handleChangeWorkspace. Run pnpm check, then simulate an IPC failure during workspace change; done means the Change Workspace button returns to its idle state and the failure is reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100