Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,25 @@ export function FileItem({

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Double-click still opens the external editor, which contradicts the intended interaction change (only cmd/ctrl-click should open externally).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/FileItem/FileItem.tsx, line 144:

<comment>Double-click still opens the external editor, which contradicts the intended interaction change (only cmd/ctrl-click should open externally).</comment>

<file context>
@@ -131,15 +131,20 @@ export function FileItem({
+				clickTimeoutRef.current = null;
+			}
+
+			openInEditor();
+		},
+		[openInEditor],
</file context>
Fix with Cubic

const fileDragProps = useFileDrag({ absolutePath });

const handleClick = useCallback(() => {
if (clickTimeoutRef.current) {
clearTimeout(clickTimeoutRef.current);
clickTimeoutRef.current = null;
}
const handleClick = useCallback(
(e: React.MouseEvent) => {
if (e.metaKey || e.ctrlKey) {
openInEditor();
return;
}
Comment on lines +116 to +119
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In the DOM event model, when a user double-clicks an element, are two clickevents fired before thedblclickevent, and would an immediateclick handler run twice?

💡 Result:

Yes, in the DOM event model, when a user double-clicks an element, two click events are fired before the dblclick event fires. An immediate click event handler will run twice—once for each individual click in the double-click sequence.

Citations:


Cmd/Ctrl-double-click opens the editor twice.

When a user Cmd/Ctrl+double-clicks, the modifier branch (Lines 116–119) fires immediately on both click events before the dblclick event fires, invoking openInEditor() twice. The handleDoubleClick handler (Lines 134–142) only clears the deferred plain-click timeout, not the immediate modifier path. This same pattern exists in FileTreeItem.tsx (Line 82) and FileSearchResultItem.tsx (Line 89). Disambiguate single vs. double-click before firing the external-editor action in the modifier branch.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/FileItem/FileItem.tsx`
around lines 116 - 119, The modifier-path currently calls openInEditor()
immediately on click causing it to fire twice on Cmd/Ctrl-double-click; instead
defer the modifier action and reuse the existing single-click debounce so
double-click can cancel it. Concretely, in the click handler (the branch that
checks e.metaKey || e.ctrlKey) replace the immediate openInEditor() with
scheduling the openInEditor call via the same timeout/ref used for plain clicks
(e.g., the click timeout ref used by handleDoubleClick) and ensure
handleDoubleClick clears that timeout and then invokes openInEditor once for the
confirmed double-click case; apply the same change pattern used in
FileTreeItem.tsx and FileSearchResultItem.tsx so modifier-clicks are
disambiguated from double-clicks.


if (clickTimeoutRef.current) {
clearTimeout(clickTimeoutRef.current);
clickTimeoutRef.current = null;
}
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.

clickTimeoutRef.current = setTimeout(() => {
clickTimeoutRef.current = null;
onClick();
}, 300);
}, [onClick]);
clickTimeoutRef.current = setTimeout(() => {
clickTimeoutRef.current = null;
onClick();
}, 300);
},
[onClick, openInEditor],
);

const handleDoubleClick = useCallback(
(e: React.MouseEvent) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export function FileSearchResultItem({

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Double-click still opens the external editor; this reintroduces the old behavior instead of reserving double-click for future pinning.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/components/FileSearchResultItem/FileSearchResultItem.tsx, line 97:

<comment>Double-click still opens the external editor; this reintroduces the old behavior instead of reserving double-click for future pinning.</comment>

<file context>
@@ -94,7 +94,7 @@ export function FileSearchResultItem({
 
 	const handleDoubleClick = () => {
-		// Reserved for future pinning behavior
+		onOpenInEditor(entry);
 	};
 
</file context>
Fix with Cubic

const handleClick = (e: React.MouseEvent) => {
if (!entry.isDirectory) {
onActivate(entry, e.metaKey || e.ctrlKey ? true : undefined);
if (e.metaKey || e.ctrlKey) {
onOpenInEditor(entry);
} else {
onActivate(entry);
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ export function FileTreeItem({
} else {
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Double-click still opens the external editor here, which contradicts the intended behavior that double-click should no longer open externally.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/components/FileTreeItem/FileTreeItem.tsx, line 90:

<comment>Double-click still opens the external editor here, which contradicts the intended behavior that double-click should no longer open externally.</comment>

<file context>
@@ -87,6 +87,7 @@ export function FileTreeItem({
 
 	const handleDoubleClick = (e: React.MouseEvent) => {
 		e.stopPropagation();
+		onOpenInEditor(entry);
 	};
 
</file context>
Fix with Cubic

item.expand();
}
} else if (e.metaKey || e.ctrlKey) {
onOpenInEditor(entry);
} else {
onActivate(entry, e.metaKey || e.ctrlKey ? true : undefined);
onActivate(entry);
}
};

Expand Down
Loading