📜 refactor: Enhance Auto Scroll Speed and UseEffect Cleanup (#1591)

This commit is contained in:
Danny Avila 2024-01-18 21:25:57 -05:00 committed by GitHub
parent a7c54573c4
commit 83292a47a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View file

@ -63,6 +63,12 @@ export default function useMessageScrolling(messagesTree?: TMessage[] | null) {
if (isSubmitting && scrollToBottom && !abortScroll) {
scrollToBottom();
}
return () => {
if (abortScroll) {
scrollToBottom && scrollToBottom?.cancel();
}
};
}, [isSubmitting, messagesTree, scrollToBottom, abortScroll]);
useEffect(() => {