| ... | ... | @@ -341,7 +341,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
| 341 | 341 | const threadKey = scopedThreadKey(threadRef); |
| 342 | 342 | const lastVisitedAt = useUiStateStore((state) => state.threadLastVisitedAtById[threadKey]); |
| 343 | 343 | const isSelected = useThreadSelectionStore((state) => state.selectedThreadKeys.has(threadKey)); |
| 344 | | const hasSelection = useThreadSelectionStore((state) => state.selectedThreadKeys.size > 0); |
| 345 | 344 | const runningTerminalIds = useTerminalStateStore( |
| 346 | 345 | (state) => |
| 347 | 346 | selectThreadTerminalState(state.terminalStateByThreadKey, threadRef).runningTerminalIds, |
| ... | ... | @@ -427,6 +426,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
| 427 | 426 | const handleRowContextMenu = useCallback( |
| 428 | 427 | (event: React.MouseEvent) => { |
| 429 | 428 | event.preventDefault(); |
| 429 | const hasSelection = useThreadSelectionStore.getState().hasSelection(); |
| 430 | 430 | if (hasSelection && isSelected) { |
| 431 | 431 | void handleMultiSelectContextMenu({ |
| 432 | 432 | x: event.clientX, |
| ... | ... | @@ -443,14 +443,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
| 443 | 443 | y: event.clientY, |
| 444 | 444 | }); |
| 445 | 445 | }, |
| 446 | | [ |
| 447 | | clearSelection, |
| 448 | | handleMultiSelectContextMenu, |
| 449 | | handleThreadContextMenu, |
| 450 | | hasSelection, |
| 451 | | isSelected, |
| 452 | | threadRef, |
| 453 | | ], |
| 446 | [clearSelection, handleMultiSelectContextMenu, handleThreadContextMenu, isSelected, threadRef], |
| 454 | 447 | ); |
| 455 | 448 | const handlePrClick = useCallback( |
| 456 | 449 | (event: React.MouseEvent<HTMLButtonElement>) => { |
| ... | ... | @@ -964,7 +957,6 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 964 | 957 | const clearSelection = useThreadSelectionStore((state) => state.clearSelection); |
| 965 | 958 | const removeFromSelection = useThreadSelectionStore((state) => state.removeFromSelection); |
| 966 | 959 | const setSelectionAnchor = useThreadSelectionStore((state) => state.setAnchor); |
| 967 | | const selectedThreadCount = useThreadSelectionStore((state) => state.selectedThreadKeys.size); |
| 968 | 960 | const { copyToClipboard: copyThreadIdToClipboard } = useCopyToClipboard<{ |
| 969 | 961 | threadId: ThreadId; |
| 970 | 962 | }>({ |
| ... | ... | @@ -1235,7 +1227,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 1235 | 1227 | event.stopPropagation(); |
| 1236 | 1228 | return; |
| 1237 | 1229 | } |
| 1238 | | if (selectedThreadCount > 0) { |
| 1230 | if (useThreadSelectionStore.getState().hasSelection()) { |
| 1239 | 1231 | clearSelection(); |
| 1240 | 1232 | } |
| 1241 | 1233 | toggleProject(project.projectKey); |
| ... | ... | @@ -1244,7 +1236,6 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 1244 | 1236 | clearSelection, |
| 1245 | 1237 | dragInProgressRef, |
| 1246 | 1238 | project.projectKey, |
| 1247 | | selectedThreadCount, |
| 1248 | 1239 | suppressProjectClickAfterDragRef, |
| 1249 | 1240 | suppressProjectClickForContextMenuRef, |
| 1250 | 1241 | toggleProject, |
| ... | ... | @@ -2833,7 +2824,6 @@ export default function Sidebar() { |
| 2833 | 2824 | const suppressProjectClickAfterDragRef = useRef(false); |
| 2834 | 2825 | const suppressProjectClickForContextMenuRef = useRef(false); |
| 2835 | 2826 | const [desktopUpdateState, setDesktopUpdateState] = useState<DesktopUpdateState | null>(null); |
| 2836 | | const selectedThreadCount = useThreadSelectionStore((s) => s.selectedThreadKeys.size); |
| 2837 | 2827 | const clearSelection = useThreadSelectionStore((s) => s.clearSelection); |
| 2838 | 2828 | const setSelectionAnchor = useThreadSelectionStore((s) => s.setAnchor); |
| 2839 | 2829 | const platform = navigator.platform; |
| ... | ... | @@ -3279,7 +3269,7 @@ export default function Sidebar() { |
| 3279 | 3269 | |
| 3280 | 3270 | useEffect(() => { |
| 3281 | 3271 | const onMouseDown = (event: globalThis.MouseEvent) => { |
| 3282 | | if (selectedThreadCount === 0) return; |
| 3272 | if (!useThreadSelectionStore.getState().hasSelection()) return; |
| 3283 | 3273 | const target = event.target instanceof HTMLElement ? event.target : null; |
| 3284 | 3274 | if (!shouldClearThreadSelectionOnMouseDown(target)) return; |
| 3285 | 3275 | clearSelection(); |
| ... | ... | @@ -3289,7 +3279,7 @@ export default function Sidebar() { |
| 3289 | 3279 | return () => { |
| 3290 | 3280 | window.removeEventListener("mousedown", onMouseDown); |
| 3291 | 3281 | }; |
| 3292 | | }, [clearSelection, selectedThreadCount]); |
| 3282 | }, [clearSelection]); |
| 3293 | 3283 | |
| 3294 | 3284 | useEffect(() => { |
| 3295 | 3285 | if (!isElectron) return; |