Merge latest origin/main into t3code/mobile-remote-connect

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex committed 2026-05-07 21:52:48 -07:00
commit 7791f47ac0
1 file changed
+5 -15
+5 -15
View File
@@ -342,7 +342,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
const threadKey = scopedThreadKey(threadRef);
const lastVisitedAt = useUiStateStore((state) => state.threadLastVisitedAtById[threadKey]);
const isSelected = useThreadSelectionStore((state) => state.selectedThreadKeys.has(threadKey));
const hasSelection = useThreadSelectionStore((state) => state.selectedThreadKeys.size > 0);
const runningTerminalIds = useThreadRunningTerminalIds({
environmentId: thread.environmentId,
threadId: thread.id,
@@ -428,6 +427,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
const handleRowContextMenu = useCallback(
(event: React.MouseEvent) => {
event.preventDefault();
const hasSelection = useThreadSelectionStore.getState().hasSelection();
if (hasSelection && isSelected) {
void handleMultiSelectContextMenu({
x: event.clientX,
@@ -444,14 +444,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
y: event.clientY,
});
},
[
clearSelection,
handleMultiSelectContextMenu,
handleThreadContextMenu,
hasSelection,
isSelected,
threadRef,
],
[clearSelection, handleMultiSelectContextMenu, handleThreadContextMenu, isSelected, threadRef],
);
const handlePrClick = useCallback(
(event: React.MouseEvent<HTMLButtonElement>) => {
@@ -965,7 +958,6 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
const clearSelection = useThreadSelectionStore((state) => state.clearSelection);
const removeFromSelection = useThreadSelectionStore((state) => state.removeFromSelection);
const setSelectionAnchor = useThreadSelectionStore((state) => state.setAnchor);
const selectedThreadCount = useThreadSelectionStore((state) => state.selectedThreadKeys.size);
const { copyToClipboard: copyThreadIdToClipboard } = useCopyToClipboard<{
threadId: ThreadId;
}>({
@@ -1236,7 +1228,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
event.stopPropagation();
return;
}
if (selectedThreadCount > 0) {
if (useThreadSelectionStore.getState().hasSelection()) {
clearSelection();
}
toggleProject(project.projectKey);
@@ -1245,7 +1237,6 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
clearSelection,
dragInProgressRef,
project.projectKey,
selectedThreadCount,
suppressProjectClickAfterDragRef,
suppressProjectClickForContextMenuRef,
toggleProject,
@@ -2834,7 +2825,6 @@ export default function Sidebar() {
const suppressProjectClickAfterDragRef = useRef(false);
const suppressProjectClickForContextMenuRef = useRef(false);
const [desktopUpdateState, setDesktopUpdateState] = useState<DesktopUpdateState | null>(null);
const selectedThreadCount = useThreadSelectionStore((s) => s.selectedThreadKeys.size);
const clearSelection = useThreadSelectionStore((s) => s.clearSelection);
const setSelectionAnchor = useThreadSelectionStore((s) => s.setAnchor);
const platform = navigator.platform;
@@ -3280,7 +3270,7 @@ export default function Sidebar() {
useEffect(() => {
const onMouseDown = (event: globalThis.MouseEvent) => {
if (selectedThreadCount === 0) return;
if (!useThreadSelectionStore.getState().hasSelection()) return;
const target = event.target instanceof HTMLElement ? event.target : null;
if (!shouldClearThreadSelectionOnMouseDown(target)) return;
clearSelection();
@@ -3290,7 +3280,7 @@ export default function Sidebar() {
return () => {
window.removeEventListener("mousedown", onMouseDown);
};
}, [clearSelection, selectedThreadCount]);
}, [clearSelection]);
useEffect(() => {
if (!isElectron) return;