From ad4177571fbae78db20042c8e25c5a05418967c9 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Wed, 5 Nov 2025 03:18:46 +0000 Subject: [PATCH 1/2] Remove sidebar click handler so cmd+click on task opens only a new tab --- components/task-sidebar.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/task-sidebar.tsx b/components/task-sidebar.tsx index 18211fc7..7192db70 100644 --- a/components/task-sidebar.tsx +++ b/components/task-sidebar.tsx @@ -363,7 +363,11 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro onTaskSelect(task)} + onClick={(e) => { + // Don't trigger navigation if user is opening in new tab (Cmd/Ctrl+Click) + if (e.metaKey || e.ctrlKey) return + onTaskSelect(task) + }} className={cn('block rounded-lg', isActive && 'ring-1 ring-primary/50 ring-offset-0')} > Date: Wed, 5 Nov 2025 03:51:16 +0000 Subject: [PATCH 2/2] Return the link as the follow-up --- components/app-layout.tsx | 16 +--------------- components/task-sidebar.tsx | 28 ++++++++-------------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/components/app-layout.tsx b/components/app-layout.tsx index 7f54badb..2dc156a9 100644 --- a/components/app-layout.tsx +++ b/components/app-layout.tsx @@ -3,7 +3,6 @@ import { useState, useEffect, createContext, useContext, useCallback } from 'react' import { TaskSidebar } from '@/components/task-sidebar' import { Task } from '@/lib/db/schema' -import { useRouter } from 'next/navigation' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' import { Plus, Trash2 } from 'lucide-react' @@ -107,7 +106,6 @@ export function AppLayout({ children, initialSidebarWidth, initialSidebarOpen, i const [isResizing, setIsResizing] = useState(false) const [isDesktop, setIsDesktop] = useState(!initialIsMobile) const [hasMounted, setHasMounted] = useState(false) - const router = useRouter() // Update sidebar width and save to cookie const updateSidebarWidth = (newWidth: number) => { @@ -210,14 +208,6 @@ export function AppLayout({ children, initialSidebarWidth, initialSidebarOpen, i } } - const handleTaskSelect = (task: Task) => { - router.push(`/tasks/${task.id}`) - // Close sidebar when navigating on mobile (don't save to cookie) - if (!isDesktop) { - updateSidebarOpen(false, false) - } - } - const addTaskOptimistically = (taskData: { prompt: string repoUrl: string @@ -347,11 +337,7 @@ export function AppLayout({ children, initialSidebarWidth, initialSidebarOpen, i width: `${sidebarWidth}px`, }} > - {isLoading ? ( - - ) : ( - - )} + {isLoading ? : } diff --git a/components/task-sidebar.tsx b/components/task-sidebar.tsx index 7192db70..9b72d1f2 100644 --- a/components/task-sidebar.tsx +++ b/components/task-sidebar.tsx @@ -75,7 +75,6 @@ const AGENT_MODELS = { interface TaskSidebarProps { tasks: Task[] - onTaskSelect: (task: Task) => void width?: number } @@ -89,7 +88,7 @@ interface RepoInfo { lastUsed: Date } -export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarProps) { +export function TaskSidebar({ tasks, width = 288 }: TaskSidebarProps) { const pathname = usePathname() const { refreshTasks, toggleSidebar } = useTasks() const session = useAtomValue(sessionAtom) @@ -100,15 +99,8 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro const [deleteStopped, setDeleteStopped] = useState(true) const [activeTab, setActiveTab] = useState('tasks') - // Close sidebar on mobile when navigating - const handleNewTaskClick = () => { - if (typeof window !== 'undefined' && window.innerWidth < 1024) { - toggleSidebar() - } - } - - // Close sidebar on mobile when selecting a repo - const handleRepoClick = () => { + // Close sidebar on mobile when clicking any link + const handleLinkClick = () => { if (typeof window !== 'undefined' && window.innerWidth < 1024) { toggleSidebar() } @@ -265,7 +257,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro > - + @@ -336,7 +328,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro > - + @@ -363,11 +355,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro { - // Don't trigger navigation if user is opening in new tab (Cmd/Ctrl+Click) - if (e.metaKey || e.ctrlKey) return - onTaskSelect(task) - }} + onClick={handleLinkClick} className={cn('block rounded-lg', isActive && 'ring-1 ring-primary/50 ring-offset-0')} > = 1 && (
- + @@ -477,7 +465,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro