diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index 9e29fcc8..f1c6f391 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -202,9 +202,10 @@ export const ButtonStop = ({ className, ...props }: ButtonHTMLAttributes { +const ScrollToBottomContainer = ({ children, className, style, scrollContainerRef }: { children: React.ReactNode, className?: string, style?: React.CSSProperties, scrollContainerRef: React.MutableRefObject }) => { const [isAtBottom, setIsAtBottom] = useState(true); // Start at bottom - const divRef = useRef(null); + + const divRef = scrollContainerRef const scrollToBottom = () => { if (divRef.current) { @@ -597,6 +598,13 @@ export const SidebarChat = () => { const keybindingString = accessor.get('IKeybindingService').lookupKeybinding(VOID_CTRL_L_ACTION_ID)?.getLabel() + // scroll to top on thread switch + const scrollContainerRef = useRef(null) + useEffect(() => { + if (isHistoryOpen) + scrollContainerRef.current?.scrollTo({ top: 0, left: 0 }) + }, [isHistoryOpen, currentThread?.id]) + return
{ {/* previous messages + current stream */} { style={{ maxHeight: sidebarDimensions.height - historyDimensions.height - formDimensions.height - 30 }} // the height of the previousMessages is determined by all other heights > {/* previous messages */} - {previousMessages.map((message, i) => )} + {previousMessages.map((message, i) => + + )} {/* message stream */}