Don't scroll once chat stream is complete
This commit is contained in:
@@ -326,6 +326,7 @@ export default function App() {
|
|||||||
const pendingTitleGenerationRef = useRef<Set<string>>(new Set());
|
const pendingTitleGenerationRef = useRef<Set<string>>(new Set());
|
||||||
const searchRunAbortRef = useRef<AbortController | null>(null);
|
const searchRunAbortRef = useRef<AbortController | null>(null);
|
||||||
const searchRunCounterRef = useRef(0);
|
const searchRunCounterRef = useRef(0);
|
||||||
|
const wasSendingRef = useRef(false);
|
||||||
const [contextMenu, setContextMenu] = useState<ContextMenuState | null>(null);
|
const [contextMenu, setContextMenu] = useState<ContextMenuState | null>(null);
|
||||||
const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false);
|
const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false);
|
||||||
const initialRouteSelectionRef = useRef<SidebarSelection | null>(readSidebarSelectionFromUrl());
|
const initialRouteSelectionRef = useRef<SidebarSelection | null>(readSidebarSelectionFromUrl());
|
||||||
@@ -530,6 +531,9 @@ export default function App() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (draftKind === "search" || selectedItem?.kind === "search") return;
|
if (draftKind === "search" || selectedItem?.kind === "search") return;
|
||||||
|
const wasSending = wasSendingRef.current;
|
||||||
|
wasSendingRef.current = isSending;
|
||||||
|
if (wasSending && !isSending) return;
|
||||||
transcriptEndRef.current?.scrollIntoView({ behavior: isSending ? "smooth" : "auto", block: "end" });
|
transcriptEndRef.current?.scrollIntoView({ behavior: isSending ? "smooth" : "auto", block: "end" });
|
||||||
}, [draftKind, selectedChat?.messages.length, isSending, selectedItem?.kind, selectedKey]);
|
}, [draftKind, selectedChat?.messages.length, isSending, selectedItem?.kind, selectedKey]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user