mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
optimistic ui for message sending and submit state
This commit is contained in:
parent
9d41ed4615
commit
6842ac880c
19 changed files with 430 additions and 92 deletions
|
|
@ -3,13 +3,31 @@ import NavLink from './NavLink';
|
|||
import TrashIcon from '../svg/TrashIcon';
|
||||
import DarkModeIcon from '../svg/DarkModeIcon';
|
||||
import LogOutIcon from '../svg/LogOutIcon';
|
||||
import manualSWR from '~/utils/fetchers';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { setConversation } from '~/store/convoSlice';
|
||||
import { setMessages } from '~/store/messageSlice';
|
||||
|
||||
export default function NavLinks() {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const { trigger, isMutating } = manualSWR(
|
||||
'http://localhost:3050/clear_convos',
|
||||
'post',
|
||||
() => {
|
||||
dispatch(setMessages([]));
|
||||
dispatch(setConversation({ conversationId: null, parentMessageId: null }));
|
||||
}
|
||||
);
|
||||
|
||||
const clickHandler = () => trigger({});
|
||||
|
||||
return (
|
||||
<>
|
||||
<NavLink
|
||||
svg={TrashIcon}
|
||||
text="Clear conversations"
|
||||
onClick={clickHandler}
|
||||
/>
|
||||
<NavLink
|
||||
svg={DarkModeIcon}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue