fix(ui): reasoning display glitches and scroll button persistence (#1206)

This commit is contained in:
josh 2025-09-16 11:41:52 +01:00 committed by GitHub
parent a1844c8294
commit b229241854
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 37 deletions

View file

@ -17,7 +17,42 @@ export function useScrollToBottom() {
// Check if we are within 100px of the bottom (like v0 does)
setIsAtBottom(scrollTop + clientHeight >= scrollHeight - 100);
}, []);
}, []);
useEffect(() => {
if (!containerRef.current) return;
const container = containerRef.current;
const resizeObserver = new ResizeObserver(() => {
requestAnimationFrame(() => {
handleScroll();
});
});
const mutationObserver = new MutationObserver(() => {
requestAnimationFrame(() => {
requestAnimationFrame(() => {
handleScroll();
});
});
});
resizeObserver.observe(container);
mutationObserver.observe(container, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['style', 'class', 'data-state']
});
handleScroll();
return () => {
resizeObserver.disconnect();
mutationObserver.disconnect();
};
}, [handleScroll]);
useEffect(() => {
const container = containerRef.current;