mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-29 00:50:22 +09:00
use config to drive autoscroll state
This commit is contained in:
parent
e186e05c7d
commit
434abbc66f
@ -379,12 +379,13 @@ function useScrollToBottom() {
|
||||
// for auto-scroll
|
||||
const scrollRef = useRef<HTMLDivElement>(null);
|
||||
const [autoScroll, setAutoScroll] = useState(true);
|
||||
|
||||
const config = useAppConfig();
|
||||
let isAutoScrollEnabled: boolean = config.autoScrollMessage;
|
||||
function scrollDomToBottom() {
|
||||
const dom = scrollRef.current;
|
||||
if (dom) {
|
||||
requestAnimationFrame(() => {
|
||||
setAutoScroll(true);
|
||||
setAutoScroll(isAutoScrollEnabled);
|
||||
dom.scrollTo(0, dom.scrollHeight);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user