mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
fix: throttle scroll to bottom
This commit is contained in:
parent
4ce60537ca
commit
4cd0ff2682
2 changed files with 4 additions and 3 deletions
|
|
@ -49,7 +49,6 @@ const inLineWrap = (parts) => {
|
|||
export default function TextWrapper({ text, generateCursor }) {
|
||||
let embedTest = false;
|
||||
let result = null;
|
||||
console.log('text wrapper', text)
|
||||
|
||||
// to match unenclosed code blocks
|
||||
if (text.match(/```/g)?.length === 1) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import React, { useEffect, useState, useRef, useCallback } from 'react';
|
||||
import Spinner from '../svg/Spinner';
|
||||
import { throttle } from 'lodash';
|
||||
import { CSSTransition } from 'react-transition-group';
|
||||
import ScrollToBottom from './ScrollToBottom';
|
||||
import MultiMessage from './MultiMessage';
|
||||
|
|
@ -34,10 +35,11 @@ export default function Messages({ messages, messageTree }) {
|
|||
};
|
||||
}, [messages]);
|
||||
|
||||
const scrollToBottom = useCallback(() => {
|
||||
const scrollToBottom = useCallback(throttle(() => {
|
||||
console.log('scrollToBottom');
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
setShowScrollButton(false);
|
||||
}, [messagesEndRef]);
|
||||
}, 750), [messagesEndRef]);
|
||||
|
||||
const handleScroll = () => {
|
||||
const { scrollTop, scrollHeight, clientHeight } = scrollableRef.current;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue