Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix message scrolling and update todo
Theo Brownefa3cccc3f9ec
diff --git a/TODO.md b/TODO.mdindex 1d33686b4..3573b48ec 100644--- a/TODO.md+++ b/TODO.md@@ -12,5 +12,5 @@- [x] Reduce noise of tool calls (combine "command run" and "command completed", make tool calls a "box" with limited # of calls shown at a time, etc)- [ ] Insta focus input on new thread creation- [ ] Disable "streaming" (wait until whole paragraph/step finishes before showing it-- [ ] Making new thread should auto-focus input box-- [ ] Threads should be scrolled to bottom on open (they currently start near top and "scroll down" after rendering, it's jank)+- [x] Making new thread should auto-focus input box+- [x] Threads should be scrolled to bottom on open (they currently start near top and "scroll down" after rendering, it's jank)diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsxindex 727ce8fb0..ba027e169 100644--- a/apps/web/src/components/ChatView.tsx+++ b/apps/web/src/components/ChatView.tsx@@ -13,6 +13,7 @@ import {type KeyboardEvent,useCallback,useEffect,+ useLayoutEffect,useMemo,useRef,useState,@@ -131,6 +132,7 @@ export default function ChatView() {const [expandedWorkGroups, setExpandedWorkGroups] = useState<Record<string, boolean>>({});const [nowTick, setNowTick] = useState(() => Date.now());const [terminalFocusRequestId, setTerminalFocusRequestId] = useState(0);+ const messagesScrollRef = useRef<HTMLDivElement>(null);const messagesEndRef = useRef<HTMLDivElement>(null);const textareaRef = useRef<HTMLTextAreaElement>(null);const composerImagesRef = useRef<ComposerImageAttachment[]>([]);@@ -345,6 +347,12 @@ export default function ChatView() {// Auto-scroll on new messagesconst messageCount = activeThread?.messages.length ?? 0;const workLogCount = workLogEntries.length;+ useLayoutEffect(() => {+ if (!activeThread?.id) return;+ const scrollContainer = messagesScrollRef.current;+ if (!scrollContainer) return;+ scrollContainer.scrollTop = scrollContainer.scrollHeight;+ }, [activeThread?.id]);useEffect(() => {messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });}, [messageCount]);@@ -1014,7 +1022,7 @@ export default function ChatView() {)}{/* Messages */}- <div className="min-h-0 flex-1 overflow-y-auto px-5 py-4">+ <div ref={messagesScrollRef} className="min-h-0 flex-1 overflow-y-auto px-5 py-4">{activeThread.messages.length === 0 && !isWorking ? (<div className="flex h-full items-center justify-center"><p className="text-sm text-muted-foreground/30">