mirror of
https://github.com/stablyai/orca.git
synced 2026-10-12 16:03:03 +00:00
Prevent worktree switch when selecting text on hovercards
Check for active text selection in the card click handler and bail out, so selecting text in PR/issue/comment hovercards doesn't accidentally switch the active worktree. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -144,11 +144,12 @@ const WorktreeCard = React.memo(function WorktreeCard({
|
||||
}
|
||||
}, [repo, worktree.linkedIssue, issue, fetchIssue, issueCacheKey])
|
||||
|
||||
// Stable click handler
|
||||
const handleClick = useCallback(
|
||||
() => setActiveWorktree(worktree.id),
|
||||
[worktree.id, setActiveWorktree]
|
||||
)
|
||||
// Stable click handler – ignore clicks that are really text selections
|
||||
const handleClick = useCallback(() => {
|
||||
const selection = window.getSelection()
|
||||
if (selection && selection.toString().length > 0) return
|
||||
setActiveWorktree(worktree.id)
|
||||
}, [worktree.id, setActiveWorktree])
|
||||
|
||||
const handleToggleUnreadQuick = useCallback(
|
||||
(event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
|
||||
Reference in New Issue
Block a user