Optimize scrolling login of query view
This commit is contained in:
parent
6977db3dd1
commit
1cbcb2a150
1 changed files with 11 additions and 3 deletions
|
|
@ -198,9 +198,17 @@ export default function RetrievalTesting() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're receiving a response, be more conservative about disabling auto-scroll
|
// Check if scrolled to bottom or very close to bottom
|
||||||
if (!isFormInteractionRef.current && !isReceivingResponseRef.current) {
|
const container = messagesContainerRef.current;
|
||||||
shouldFollowScrollRef.current = false;
|
if (container) {
|
||||||
|
const isAtBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 20;
|
||||||
|
|
||||||
|
// If at bottom, enable auto-scroll, otherwise disable it
|
||||||
|
if (isAtBottom) {
|
||||||
|
shouldFollowScrollRef.current = true;
|
||||||
|
} else if (!isFormInteractionRef.current && !isReceivingResponseRef.current) {
|
||||||
|
shouldFollowScrollRef.current = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 30);
|
}, 30);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue