mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
refactor(client): convert ClearConvos component from jsx to tsx
refactor(client): convert Dialog, DialogButton, Input, Label, Checkbox, and DialogTemplate components from jsx to tsx refactor(client): export ClearChatsButton component from General.tsx refactor(client): add useCallback hook to moveToTop function in Nav component
This commit is contained in:
parent
c661276888
commit
931a89204c
6 changed files with 50 additions and 53 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import { useState, useEffect, useRef, useContext } from 'react';
|
||||
import { useState, useEffect, useRef, useContext, useCallback } from 'react';
|
||||
import NewChat from './NewChat';
|
||||
import Panel from '../svg/Panel';
|
||||
import Spinner from '../svg/Spinner';
|
||||
|
|
@ -100,12 +100,12 @@ export default function Nav({ navVisible, setNavVisible }) {
|
|||
}
|
||||
};
|
||||
|
||||
const moveToTop = () => {
|
||||
const moveToTop = useCallback(() => {
|
||||
const container = containerRef.current;
|
||||
if (container) {
|
||||
scrollPositionRef.current = container.scrollTop;
|
||||
}
|
||||
};
|
||||
}, [containerRef, scrollPositionRef]);
|
||||
|
||||
const nextPage = async () => {
|
||||
moveToTop();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue