mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-01 08:08:49 +01:00
fix: force navigation to /chat/new on endpoint change and conversation deletions (#1141)
This commit is contained in:
parent
0886441461
commit
a2ee57568a
7 changed files with 76 additions and 61 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { useRecoilState } from 'recoil';
|
||||
import * as Tabs from '@radix-ui/react-tabs';
|
||||
import React, { useState, useContext, useEffect, useCallback, useRef } from 'react';
|
||||
import React, { useState, useContext, useCallback, useRef } from 'react';
|
||||
import { useClearConversationsMutation } from 'librechat-data-provider';
|
||||
import {
|
||||
ThemeContext,
|
||||
|
|
@ -116,22 +116,23 @@ function General() {
|
|||
const contentRef = useRef(null);
|
||||
useOnClickOutside(contentRef, () => confirmClear && setConfirmClear(false), []);
|
||||
|
||||
useEffect(() => {
|
||||
if (clearConvosMutation.isSuccess) {
|
||||
newConversation();
|
||||
refreshConversations();
|
||||
}
|
||||
}, [clearConvosMutation.isSuccess, newConversation, refreshConversations]);
|
||||
|
||||
const clearConvos = useCallback(() => {
|
||||
const clearConvos = () => {
|
||||
if (confirmClear) {
|
||||
console.log('Clearing conversations...');
|
||||
clearConvosMutation.mutate({});
|
||||
setConfirmClear(false);
|
||||
clearConvosMutation.mutate(
|
||||
{},
|
||||
{
|
||||
onSuccess: () => {
|
||||
newConversation();
|
||||
refreshConversations();
|
||||
},
|
||||
},
|
||||
);
|
||||
} else {
|
||||
setConfirmClear(true);
|
||||
}
|
||||
}, [confirmClear, clearConvosMutation]);
|
||||
};
|
||||
|
||||
const changeTheme = useCallback(
|
||||
(value: string) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue