diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 82b348936c45d136011a91d9a2cefa8e78045b71..349034fdcf6c39a4a8a1de9ea26f519ae33a0885 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -298,13 +298,13 @@ export default function Sidebar() { dispatch({ type: "DELETE_THREAD", threadId }); - if (!shouldDeleteWorktree || !orphanedWorktreePath) { + if (!shouldDeleteWorktree || !orphanedWorktreePath || !threadProject) { return; } try { await api.git.removeWorktree({ - cwd: threadProject?.cwd ?? orphanedWorktreePath, + cwd: threadProject.cwd, path: orphanedWorktreePath, }); } catch {