@devries-cameron20 / t3code-1 / commits / e0fa102aa3
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): changing the sidebar project filter starts the list at the top (#27327)

Igor Makowski committed Nov 1, 2026 at 03:37 UTC e0fa102aa374d5ae49b5bfaaceddf8bd161c7e69
1 file changed +8
apps/web/src/components/Sidebar.tsx
+8
@@ -362,6 +362,10 @@ interface SidebarThreadPartitionInput {
362 readonly clockKey: string;
363 }
364
365 +function scrollSidebarToTop(content: HTMLElement | null) {
366 + content?.closest("[data-slot=scroll-area-viewport]")?.scrollTo({ top: 0 });
367 +}
368 +
369 function threadShellKey(thread: Pick<SidebarThreadSummary, "environmentId" | "id">): string {
370 return scopedThreadKey(scopeThreadRef(thread.environmentId, thread.id));
371 }
@@ -1054,6 +1058,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1058 const [renamingTitle, setRenamingTitle] = useState("");
1059 const settlingThreadKeysRef = useRef(new Set<string>());
1060 const threadListRef = useRef<HTMLUListElement | null>(null);
1061 + const sidebarContentRef = useRef<HTMLDivElement | null>(null);
1062 const dragLabelOffsetRef = useRef(0);
1063 const listMotionRef = useRef<ReturnType<typeof createSidebarListMotion> | null>(null);
1064 const [dragState, setDragState] = useState<{
@@ -1079,9 +1084,11 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1084 const routeThreadKey = routeThreadRef ? scopedThreadKey(routeThreadRef) : null;
1085
1086 // A selection made under one scope can hold threads the next scope hides.
1087 + // The viewport outlives the scope and does not anchor, so a new list starts at the top.
1088 const setProjectScopeKeys = (keys: readonly string[]) => {
1089 clearSelection();
1090 setPersistedProjectScopeKeys(keys);
1091 + scrollSidebarToTop(sidebarContentRef.current);
1092 };
1093 // A scope whose project is gone reads as all projects once every snapshot has
1094 // loaded. The stored keys are left alone, so the scope returns with its project.
@@ -2977,6 +2984,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
2984 <ThreadContextDragGhost />
2985 <SidebarChromeHeader isElectron={isElectron} />
2986 <SidebarContent
2987 + ref={sidebarContentRef}
2988 className="min-h-full"
2989 fixedHeader={
2990 <SidebarGroup className="z-[1]">