@devries-cameron20 / t3code Mirror · read-only / commits / d41781987c
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 07:30 UTC

fix(web): preserve scroll when collapsing large changed-files trees (#1113)

Craig committed Mar 30, 2026 at 10:53 UTC d41781987cea30ad3ff7d344292ecdfbf9325900
2 files changed +8 -1
apps/web/src/components/chat/ChangedFilesTree.tsx
+1
@@ -50,6 +50,7 @@ export const ChangedFilesTree = memo(function ChangedFilesTree(props: {
50 <div key={`dir:${node.path}`}>
51 <button
52 type="button"
53 + data-scroll-anchor-ignore
54 className="group flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left hover:bg-background/80"
55 style={{ paddingLeft: `${leftPadding}px` }}
56 onClick={() => toggleDirectory(node.path, depth === 0)}
apps/web/src/components/chat/MessagesTimeline.tsx
+7 -1
@@ -264,9 +264,14 @@ export const MessagesTimeline = memo(function MessagesTimeline({
264 rowVirtualizer.measure();
265 }, [rowVirtualizer, timelineWidthPx]);
266 useEffect(() => {
267 - rowVirtualizer.shouldAdjustScrollPositionOnItemSizeChange = (_item, _delta, instance) => {
267 + rowVirtualizer.shouldAdjustScrollPositionOnItemSizeChange = (item, _delta, instance) => {
268 const viewportHeight = instance.scrollRect?.height ?? 0;
269 const scrollOffset = instance.scrollOffset ?? 0;
270 + const itemIntersectsViewport =
271 + item.end > scrollOffset && item.start < scrollOffset + viewportHeight;
272 + if (itemIntersectsViewport) {
273 + return false;
274 + }
275 const remainingDistance = instance.getTotalSize() - (scrollOffset + viewportHeight);
276 return remainingDistance > AUTO_SCROLL_BOTTOM_THRESHOLD_PX;
277 };
@@ -483,6 +488,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
488 type="button"
489 size="xs"
490 variant="outline"
491 + data-scroll-anchor-ignore
492 onClick={() => onToggleAllDirectories(turnSummary.turnId)}
493 >
494 {allDirectoriesExpanded ? "Collapse all" : "Expand all"}