File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11import type { Task } from "@shared/types" ;
22import { useMutation , useQuery , useQueryClient } from "@tanstack/react-query" ;
33import { useAuthStore } from "../stores/authStore" ;
4+ import { useTaskExecutionStore } from "../stores/taskExecutionStore" ;
45
56export const taskKeys = {
67 all : [ "tasks" ] as const ,
@@ -120,7 +121,15 @@ export function useDuplicateTask() {
120121 if ( ! client ) throw new Error ( "Not authenticated" ) ;
121122 return ( await client . duplicateTask ( taskId ) ) as unknown as Task ;
122123 } ,
123- onSuccess : ( ) => {
124+ onSuccess : ( newTask , originalTaskId ) => {
125+ // Copy working directory from original task to new task
126+ const { getTaskState, setRepoPath } = useTaskExecutionStore . getState ( ) ;
127+ const originalState = getTaskState ( originalTaskId ) ;
128+
129+ if ( originalState . repoPath ) {
130+ setRepoPath ( newTask . id , originalState . repoPath ) ;
131+ }
132+
124133 queryClient . invalidateQueries ( { queryKey : taskKeys . lists ( ) } ) ;
125134 } ,
126135 } ) ;
You can’t perform that action at this time.
0 commit comments