@@ -312,7 +312,7 @@ const Tasks = () => {
312312 throw new Error ( data . error || "Failed to add task" )
313313 }
314314 toast . success ( "New plan created successfully!" )
315- posthog . capture ( "workflow_created" , {
315+ posthog ? .capture ( "workflow_created" , {
316316 plan_steps : taskData . plan . length ,
317317 is_recurring : taskData . schedule . type === "recurring" ,
318318 priority : taskData . priority
@@ -370,7 +370,7 @@ const Tasks = () => {
370370 } )
371371 } )
372372 if ( ! response . ok ) throw new Error ( ( await response . json ( ) ) . error )
373- posthog . capture ( "task_edited" , {
373+ posthog ? .capture ( "task_edited" , {
374374 task_id : editingTask . task_id ,
375375 is_recurring : editingTask . schedule ?. type === "recurring"
376376 } )
@@ -395,7 +395,7 @@ const Tasks = () => {
395395 toast . success ( "Task deleted!" )
396396 setViewingTask ( null )
397397 if ( taskToDelete ?. status === "approval_pending" ) {
398- posthog . capture ( "task_disapproved" , { task_id : taskId } )
398+ posthog ? .capture ( "task_disapproved" , { task_id : taskId } )
399399 }
400400 await fetchTasksData ( )
401401 } catch ( error ) {
@@ -416,7 +416,7 @@ const Tasks = () => {
416416 toast . error ( errorData . detail , { duration : 6000 } )
417417 else throw new Error ( errorData . error || "Approval failed" )
418418 } else {
419- posthog . capture ( "task_approved" , { task_id : taskId } )
419+ posthog ? .capture ( "task_approved" , { task_id : taskId } )
420420 toast . success ( "Plan approved and queued for execution." )
421421 }
422422 setViewingTask ( null )
@@ -438,7 +438,7 @@ const Tasks = () => {
438438 body : JSON . stringify ( { taskId } )
439439 } )
440440 if ( ! response . ok ) throw new Error ( ( await response . json ( ) ) . error )
441- posthog . capture ( "task_rerun" , { original_task_id : taskId } )
441+ posthog ? .capture ( "task_rerun" , { original_task_id : taskId } )
442442 toast . success ( "Task duplicated for approval." )
443443 await fetchTasksData ( )
444444 } catch ( error ) {
0 commit comments