-
-
Notifications
You must be signed in to change notification settings - Fork 777
Description
Checklist
- I searched existing issues and this hasn't been reported
Area
Frontend
Operating System
macOS
Version
2.7.2 (develop branch, commit 230de5f)
What happened?
The Electron app uses 70-90% CPU when idle. Investigation shows repeated IPC calls between renderer and main process:
[IPC] TASK_LIST called with projectId: e57c7e91-dd6f-48b0-b33a-5dcd4965ca55
[ProjectStore] getTasks called with projectId: e57c7e91-dd6f-48b0-b33a-5dcd4965ca55
[ProjectStore] Found project: resumocast_portal autoBuildPath: .auto-claude
[ProjectStore] Loaded 20 tasks from main project
[ProjectStore] Loaded 3 tasks from worktree: 009-fix-unauthenticated-access...
[ProjectStore] Loaded 3 tasks from worktree: 010-sanitize-search-highlight...
... (11 worktrees with 3 tasks each)
[IPC] TASK_LIST returning 20 tasks
[IPC] PROJECT_LIST returning 2 projects
[IPC] TASK_LIST called with projectId: e57c7e91-dd6f-48b0-b33a-5dcd4965ca55
... (repeats continuously)
This appears to be a re-render loop in React that survived the fix in PR #362.
Related Issue
This is different from #231 (lsof spawning) - that issue is about backend task execution. This issue occurs when the app is idle with no tasks running.
Environment Details
- Project has 20 tasks in main project
- 11 git worktrees, each with 3 tasks
- 2 projects open in tabs
Steps to reproduce
- Open a project with many tasks and worktrees
- Keep the app idle (no tasks running)
- Monitor CPU usage - stays at 70-90%
- Check logs - repeated TASK_LIST and PROJECT_LIST calls
Expected behavior
CPU should be low (< 5%) when app is idle with no tasks running.
Suspected Cause
In App.tsx line 309-327, the useEffect that calls loadTasks() has these dependencies:
}, [activeProjectId, selectedProjectId, selectedProject?.path, selectedProject?.name]);selectedProject is computed each render:
const selectedProject = projects.find((p) => p.id === (activeProjectId || selectedProjectId));If the projects array reference changes, selectedProject becomes a new object, causing selectedProject?.path and selectedProject?.name to trigger the effect even when values haven't changed.
Possible Fix
- Memoize
selectedProjectwithuseMemo - Or extract
pathandnamebefore the dependency array comparison - Or use primitive values directly in dependencies instead of object properties
Logs / Screenshots
CPU usage while idle:
PID CPU Process
60952 72.2% Electron Helper (GPU)
60955 13.8% Electron Helper (Renderer)
60887 1.1% Electron Main
🤖 Generated with Claude Code