@devries-cameron20 / t3code Mirror · read-only / commits / 36cdceb4bf
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, 19:45 UTC

Fix ChatView height scroll

Julius Marminge committed Feb 11, 2026 at 18:08 UTC 36cdceb4bff336dbb53ad638806e4e1a88043b73
2 files changed +32 -9
apps/web/src/components/ChatView.tsx
+3 -3
@@ -628,7 +628,7 @@ export default function ChatView() {
628 // Empty state: no active thread
629 if (!activeThread) {
630 return (
631 - <div className="flex flex-1 flex-col bg-background text-muted-foreground/40">
631 + <div className="flex min-h-0 flex-1 flex-col bg-background text-muted-foreground/40">
632 {isElectron && <div className="drag-region h-[52px] shrink-0" />}
633 <div className="flex flex-1 items-center justify-center">
634 <div className="text-center">
@@ -640,7 +640,7 @@ export default function ChatView() {
640 }
641
642 return (
643 - <div className="flex flex-1 flex-col bg-background">
643 + <div className="flex min-h-0 flex-1 flex-col bg-background">
644 {/* Top bar */}
645 <header
646 className={`flex items-center justify-between border-b border-border px-5 pb-3 ${isElectron ? "drag-region pt-[28px]" : "pt-3"}`}
@@ -787,7 +787,7 @@ export default function ChatView() {
787 )}
788
789 {/* Messages */}
790 - <div className="flex-1 overflow-y-auto px-5 py-4">
790 + <div className="min-h-0 flex-1 overflow-y-auto px-5 py-4">
791 {activeThread.messages.length === 0 && !isWorking ? (
792 <div className="flex h-full items-center justify-center">
793 <p className="text-sm text-muted-foreground/30">
apps/web/src/components/ThreadTerminalDrawer.tsx
+29 -6
@@ -129,6 +129,7 @@ export default function ThreadTerminalDrawer({
129 startY: number;
130 startHeight: number;
131 } | null>(null);
132 + const didResizeDuringDragRef = useRef(false);
133
134 useEffect(() => {
135 onHeightChangeRef.current = onHeightChange;
@@ -152,11 +153,17 @@ export default function ThreadTerminalDrawer({
153 [],
154 );
155
155 - const fitAndResizeTerminal = useCallback(() => {
156 + const fitAndResizeTerminal = useCallback((preserveBottom = false) => {
157 const activeTerminal = terminalRef.current;
158 const activeFitAddon = fitAddonRef.current;
159 if (!activeTerminal || !activeFitAddon) return;
160 + const wasAtBottom =
161 + preserveBottom &&
162 + activeTerminal.buffer.active.viewportY >= activeTerminal.buffer.active.baseY;
163 activeFitAddon.fit();
164 + if (wasAtBottom) {
165 + activeTerminal.scrollToBottom();
166 + }
167 void api.terminal
168 .resize({
169 threadId,
@@ -177,13 +184,14 @@ export default function ThreadTerminalDrawer({
184 if (event.button !== 0) return;
185 event.preventDefault();
186 event.currentTarget.setPointerCapture(event.pointerId);
187 + didResizeDuringDragRef.current = false;
188 resizeStateRef.current = {
189 pointerId: event.pointerId,
190 startY: event.clientY,
183 - startHeight: drawerHeight,
191 + startHeight: drawerHeightRef.current,
192 };
193 },
186 - [drawerHeight],
194 + [],
195 );
196
197 const handleResizePointerMove = useCallback(
@@ -194,6 +202,11 @@ export default function ThreadTerminalDrawer({
202 const clampedHeight = clampDrawerHeight(
203 resizeState.startHeight + (resizeState.startY - event.clientY),
204 );
205 + if (clampedHeight === drawerHeightRef.current) {
206 + return;
207 + }
208 + didResizeDuringDragRef.current = true;
209 + drawerHeightRef.current = clampedHeight;
210 setDrawerHeight(clampedHeight);
211 },
212 [],
@@ -207,9 +220,13 @@ export default function ThreadTerminalDrawer({
220 if (event.currentTarget.hasPointerCapture(event.pointerId)) {
221 event.currentTarget.releasePointerCapture(event.pointerId);
222 }
223 + if (!didResizeDuringDragRef.current) {
224 + return;
225 + }
226 syncHeight(drawerHeightRef.current);
227 + fitAndResizeTerminal(true);
228 },
212 - [syncHeight],
229 + [fitAndResizeTerminal, syncHeight],
230 );
231
232 useEffect(() => {
@@ -219,7 +236,7 @@ export default function ThreadTerminalDrawer({
236 if (changed) {
237 setDrawerHeight(clampedHeight);
238 } else {
222 - fitAndResizeTerminal();
239 + fitAndResizeTerminal(true);
240 }
241 if (!resizeStateRef.current) {
242 syncHeight(clampedHeight);
@@ -366,7 +383,9 @@ export default function ThreadTerminalDrawer({
383 }
384 });
385
369 - const fitTimer = window.setTimeout(fitAndResizeTerminal, 30);
386 + const fitTimer = window.setTimeout(() => {
387 + fitAndResizeTerminal(true);
388 + }, 30);
389 void openTerminal();
390
391 return () => {
@@ -396,8 +415,12 @@ export default function ThreadTerminalDrawer({
415 const terminal = terminalRef.current;
416 const fitAddon = fitAddonRef.current;
417 if (!terminal || !fitAddon) return;
418 + const wasAtBottom = terminal.buffer.active.viewportY >= terminal.buffer.active.baseY;
419 const frame = window.requestAnimationFrame(() => {
420 fitAddon.fit();
421 + if (wasAtBottom) {
422 + terminal.scrollToBottom();
423 + }
424 void api.terminal
425 .resize({
426 threadId,