Skip to content
Merged
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
31 changes: 27 additions & 4 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ import {
SidebarMenuSubItem,
SidebarSeparator,
SidebarTrigger,
useSidebar,
} from "./ui/sidebar";
import { useThreadSelectionStore } from "../threadSelectionStore";
import { useCommandPaletteStore } from "../commandPaletteStore";
Expand Down Expand Up @@ -931,6 +932,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
}));
const { updateSettings } = useUpdateSettings();
const router = useRouter();
const { isMobile, setOpenMobile } = useSidebar();
const markThreadUnread = useUiStateStore((state) => state.markThreadUnread);
const toggleProject = useUiStateStore((state) => state.toggleProject);
const toggleThreadSelection = useThreadSelectionStore((state) => state.toggleThread);
Expand Down Expand Up @@ -1519,12 +1521,15 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
clearSelection();
}
setSelectionAnchor(scopedThreadKey(threadRef));
if (isMobile) {
setOpenMobile(false);
}
void router.navigate({
to: "/$environmentId/$threadId",
params: buildThreadRouteParams(threadRef),
});
},
[clearSelection, router, setSelectionAnchor],
[clearSelection, isMobile, router, setOpenMobile, setSelectionAnchor],
);

const handleThreadClick = useCallback(
Expand Down Expand Up @@ -1555,12 +1560,23 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
clearSelection();
}
setSelectionAnchor(threadKey);
if (isMobile) {
setOpenMobile(false);
}
void router.navigate({
to: "/$environmentId/$threadId",
params: buildThreadRouteParams(threadRef),
});
},
[clearSelection, rangeSelectTo, router, setSelectionAnchor, toggleThreadSelection],
[
clearSelection,
isMobile,
rangeSelectTo,
router,
setOpenMobile,
setSelectionAnchor,
toggleThreadSelection,
],
);

const handleMultiSelectContextMenu = useCallback(
Expand Down Expand Up @@ -1658,6 +1674,9 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
}
: null,
});
if (isMobile) {
setOpenMobile(false);
}
void handleNewThread(scopeProjectRef(member.environmentId, member.id), {
...(seedContext.branch !== undefined ? { branch: seedContext.branch } : {}),
...(seedContext.worktreePath !== undefined
Expand All @@ -1666,7 +1685,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
envMode: seedContext.envMode,
});
},
[defaultThreadEnvMode, handleNewThread, router],
[defaultThreadEnvMode, handleNewThread, isMobile, router, setOpenMobile],
);

const handleCreateThreadClick = useCallback(
Expand Down Expand Up @@ -2703,6 +2722,7 @@ export default function Sidebar() {
const { updateSettings } = useUpdateSettings();
const { handleNewThread } = useNewThreadHandler();
const { archiveThread, deleteThread } = useThreadActions();
const { isMobile, setOpenMobile } = useSidebar();
const routeThreadRef = useParams({
strict: false,
select: (params) => resolveThreadRouteRef(params),
Expand Down Expand Up @@ -2855,12 +2875,15 @@ export default function Sidebar() {
clearSelection();
}
setSelectionAnchor(scopedThreadKey(threadRef));
if (isMobile) {
setOpenMobile(false);
}
Comment on lines +2878 to +2880
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

The nearby comment describing the plain-click behavior doesn’t mention that we now also close the mobile sidebar. Please update the comment so it remains accurate.

Copilot uses AI. Check for mistakes.
void navigate({
to: "/$environmentId/$threadId",
params: buildThreadRouteParams(threadRef),
});
},
[clearSelection, navigate, setSelectionAnchor],
[clearSelection, isMobile, navigate, setOpenMobile, setSelectionAnchor],
);

const projectDnDSensors = useSensors(
Expand Down
Loading