Skip to content

Commit 6f43cb1

Browse files
committed
Fix sidebar new task button not setting folder
1 parent 452a25c commit 6f43cb1

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

apps/code/src/renderer/features/sidebar/components/TaskListView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ export function TaskListView({
318318
f.remoteUrl?.toLowerCase() === group.id.toLowerCase() ||
319319
f.path === group.id,
320320
);
321+
const groupFolderId =
322+
folder?.id ?? group.tasks.find((t) => t.folderId)?.folderId;
321323
return (
322324
<DraggableFolder key={group.id} id={group.id} index={index}>
323325
<SidebarSection
@@ -335,8 +337,8 @@ export function TaskListView({
335337
addSpacingBefore={false}
336338
tooltipContent={folder?.path ?? group.id}
337339
onNewTask={() => {
338-
if (folder) {
339-
navigateToTaskInput(folder.id);
340+
if (groupFolderId) {
341+
navigateToTaskInput(groupFolderId);
340342
} else {
341343
navigateToTaskInput();
342344
}

apps/code/src/renderer/features/sidebar/hooks/useSidebarData.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface TaskData {
2525
isPinned: boolean;
2626
needsPermission: boolean;
2727
repository: TaskRepositoryInfo | null;
28+
folderId?: string;
2829
taskRunStatus?:
2930
| "started"
3031
| "in_progress"
@@ -203,6 +204,7 @@ export function useSidebarData({
203204
isPinned: pinnedTaskIds.has(task.id),
204205
needsPermission: (session?.pendingPermissions?.size ?? 0) > 0,
205206
repository: getRepositoryInfo(task, workspace?.folderPath),
207+
folderId: workspace?.folderId || undefined,
206208
taskRunStatus: task.latest_run?.status,
207209
taskRunEnvironment: task.latest_run?.environment,
208210
};

0 commit comments

Comments
 (0)