diff --git a/webview-ui/src/App.tsx b/webview-ui/src/App.tsx index 3c4c14f5df..b505a85250 100644 --- a/webview-ui/src/App.tsx +++ b/webview-ui/src/App.tsx @@ -91,6 +91,9 @@ const App = () => { messageTs: 0, }) + // Track if the user has seen the edit warning - using ref to persist across renders + const hasSeenEditWarningRef = useRef(false) + const [editMessageDialogState, setEditMessageDialogState] = useState({ isOpen: false, messageTs: 0, @@ -158,12 +161,23 @@ const App = () => { } if (message.type === "showEditMessageDialog" && message.messageTs && message.text) { - setEditMessageDialogState({ - isOpen: true, - messageTs: message.messageTs, - text: message.text, - images: message.images || [], - }) + // If the user has already seen the warning, skip the dialog and directly edit + if (hasSeenEditWarningRef.current) { + vscode.postMessage({ + type: "editMessageConfirm", + messageTs: message.messageTs, + text: message.text, + images: message.images || [], + }) + } else { + // Show the warning dialog for the first time + setEditMessageDialogState({ + isOpen: true, + messageTs: message.messageTs, + text: message.text, + images: message.images || [], + }) + } } if (message.type === "acceptInput") { @@ -267,6 +281,8 @@ const App = () => { open={editMessageDialogState.isOpen} onOpenChange={(open) => setEditMessageDialogState((prev) => ({ ...prev, isOpen: open }))} onConfirm={() => { + // Mark that the user has seen the edit warning + hasSeenEditWarningRef.current = true vscode.postMessage({ type: "editMessageConfirm", messageTs: editMessageDialogState.messageTs, diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 926bd400f0..37ec59a478 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1082,7 +1082,12 @@ export const ChatRowContent = ({ ) : (
-
+
{ + e.stopPropagation() + handleEditClick() + }}>