mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	use config to drive autoscroll state
This commit is contained in:
		@@ -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);
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user