From 9b1e6359c1e655c503a7554ce03c0029402e94d4 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sat, 2 Aug 2025 09:16:54 +0000 Subject: [PATCH] fix: prevent task deletion when clicking on history items - Modified TaskItem component to prevent automatic task resumption on click - Added explicit Resume button to TaskItemFooter for intentional task resumption - Task items now only respond to clicks in selection mode for checkbox toggling - Added translation for "Resume Task" button - Preserves existing export functionality for non-destructive task viewing Fixes #6592 --- webview-ui/src/components/history/TaskItem.tsx | 18 ++++++++++++++---- .../src/components/history/TaskItemFooter.tsx | 17 ++++++++++++++++- webview-ui/src/i18n/locales/en/history.json | 1 + 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/webview-ui/src/components/history/TaskItem.tsx b/webview-ui/src/components/history/TaskItem.tsx index 5338819dd3..428383f20a 100644 --- a/webview-ui/src/components/history/TaskItem.tsx +++ b/webview-ui/src/components/history/TaskItem.tsx @@ -36,9 +36,13 @@ const TaskItem = ({ const handleClick = () => { if (isSelectionMode && onToggleSelection) { onToggleSelection(item.id, !isSelected) - } else { - vscode.postMessage({ type: "showTaskWithId", text: item.id }) } + // Removed the automatic showTaskWithId call + } + + const handleResumeClick = (e: React.MouseEvent) => { + e.stopPropagation() + vscode.postMessage({ type: "showTaskWithId", text: item.id }) } const isCompact = variant === "compact" @@ -48,7 +52,8 @@ const TaskItem = ({ key={item.id} data-testid={`task-item-${item.id}`} className={cn( - "cursor-pointer group bg-vscode-editor-background rounded relative overflow-hidden hover:border-vscode-toolbar-hoverBackground/60", + "group bg-vscode-editor-background rounded relative overflow-hidden hover:border-vscode-toolbar-hoverBackground/60", + isSelectionMode ? "cursor-pointer" : "cursor-default", className, )} onClick={handleClick}> @@ -84,7 +89,12 @@ const TaskItem = ({ {/* Task Item Footer */} - + {/* Workspace info */} {showWorkspace && item.workspace && ( diff --git a/webview-ui/src/components/history/TaskItemFooter.tsx b/webview-ui/src/components/history/TaskItemFooter.tsx index 424cf1eadb..d66339239f 100644 --- a/webview-ui/src/components/history/TaskItemFooter.tsx +++ b/webview-ui/src/components/history/TaskItemFooter.tsx @@ -5,14 +5,18 @@ import prettyBytes from "pretty-bytes" import { formatLargeNumber } from "@/utils/format" import { CopyButton } from "./CopyButton" import { ExportButton } from "./ExportButton" +import { Button, StandardTooltip } from "@/components/ui" +import { useAppTranslation } from "@/i18n/TranslationContext" export interface TaskItemFooterProps { item: HistoryItem variant: "compact" | "full" isSelectionMode?: boolean + onResumeClick?: (e: React.MouseEvent) => void } -const TaskItemFooter: React.FC = ({ item, variant, isSelectionMode = false }) => { +const TaskItemFooter: React.FC = ({ item, variant, isSelectionMode = false, onResumeClick }) => { + const { t } = useAppTranslation() return (
@@ -52,6 +56,17 @@ const TaskItemFooter: React.FC = ({ item, variant, isSelect {/* Action Buttons for non-compact view */} {!isSelectionMode && (
+ {onResumeClick && ( + + + + )} {variant === "full" && }
diff --git a/webview-ui/src/i18n/locales/en/history.json b/webview-ui/src/i18n/locales/en/history.json index 8d00433170..dcd3158b2b 100644 --- a/webview-ui/src/i18n/locales/en/history.json +++ b/webview-ui/src/i18n/locales/en/history.json @@ -13,6 +13,7 @@ "deleteTaskTitle": "Delete Task (Shift + Click to skip confirmation)", "copyPrompt": "Copy Prompt", "exportTask": "Export Task", + "resumeTask": "Resume Task", "deleteTask": "Delete Task", "deleteTaskMessage": "Are you sure you want to delete this task? This action cannot be undone.", "cancel": "Cancel",