@@ -575,15 +575,24 @@ export const completeTask = async (
575575 return { success : false , error : `Failed to archive task: ${ archiveError . message } ` } ;
576576 }
577577
578- // Fetch project and board info for the notification URL
579- const { data : colData } = await supabase
578+ // Fetch board and project info for the notification URL
579+ const { data : columnData } = await supabase
580580 . from ( "kanban_columns" )
581- . select ( "board_id, kanban_boards(project_id) " )
581+ . select ( "board_id" )
582582 . eq ( "id" , task . kanban_column_id )
583583 . single ( ) ;
584584
585- const boardId = colData ?. board_id ;
586- const projectId = ( colData ?. kanban_boards as any ) ?. project_id ;
585+ const boardId = columnData ?. board_id ;
586+ let projectId = null ;
587+
588+ if ( boardId ) {
589+ const { data : boardData } = await supabase
590+ . from ( "kanban_boards" )
591+ . select ( "project_id" )
592+ . eq ( "id" , boardId )
593+ . single ( ) ;
594+ projectId = boardData ?. project_id ;
595+ }
587596
588597 // OPTIMIZATION: Prepare all member IDs and points
589598 const sidekickPoints = Math . floor ( taskPoints * 0.5 ) ;
@@ -695,10 +704,13 @@ export const completeTask = async (
695704 }
696705
697706 // Single revalidation at the end
707+ revalidatePath ( "/home/kanban" ) ;
708+ if ( projectId ) {
709+ revalidatePath ( `/home/kanban/${ projectId } ` ) ;
710+ }
698711 if ( projectId && boardId ) {
699712 revalidatePath ( `/home/kanban/${ projectId } /${ boardId } ` ) ;
700713 }
701- revalidatePath ( "/home/kanban" ) ;
702714
703715 return { success : true } ;
704716 } catch ( error ) {
0 commit comments