mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
feat: Add RQ to Conversation component, create temp Chat component with RQ for compare and debugging
This commit is contained in:
parent
39f53e6ddf
commit
c6d3bcd457
3 changed files with 114 additions and 12 deletions
|
|
@ -8,6 +8,8 @@ import {
|
|||
} from "@tanstack/react-query";
|
||||
import * as t from "./types";
|
||||
import * as dataService from "./data-service";
|
||||
import { useRecoilState, useResetRecoilState, useSetRecoilState } from 'recoil';
|
||||
import store from '~/store';
|
||||
|
||||
export enum QueryKeys {
|
||||
messages = "messsages",
|
||||
|
|
@ -66,13 +68,17 @@ export const useUpdateConversationMutation = (
|
|||
t.TUpdateConversationRequest,
|
||||
unknown
|
||||
> => {
|
||||
const [conversation, setConversation] = useRecoilState(store.conversation);
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(
|
||||
(payload: t.TUpdateConversationRequest) =>
|
||||
dataService.updateConversation(payload),
|
||||
{
|
||||
onSuccess: () => {
|
||||
onSuccess: (res) => {
|
||||
console.log('res', res);
|
||||
setConversation(res);
|
||||
queryClient.invalidateQueries([QueryKeys.conversation, id]);
|
||||
queryClient.invalidateQueries([QueryKeys.allConversations, id]);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue