mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 19:00:13 +01:00
fix(Settings/General): fix clear convos bug where active convo would still appear after clearing convos
This commit is contained in:
parent
dd8bc39001
commit
8959576d75
2 changed files with 13 additions and 15 deletions
|
|
@ -1,18 +1,14 @@
|
|||
import * as Tabs from '@radix-ui/react-tabs';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/Dialog.tsx';
|
||||
import { General } from './SettingsTabs/';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui';
|
||||
import { General } from './';
|
||||
import { CogIcon } from '~/components/svg';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { cn } from '~/utils/';
|
||||
import { useClearConversationsMutation } from '@librechat/data-provider';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import store from '~/store';
|
||||
import { localize } from '~/localization/Translation';
|
||||
import store from '~/store';
|
||||
|
||||
export default function Settings({ open, onOpenChange }) {
|
||||
const { newConversation } = store.useConversation();
|
||||
const { refreshConversations } = store.useConversations();
|
||||
const clearConvosMutation = useClearConversationsMutation();
|
||||
const [confirmClear, setConfirmClear] = useState(false);
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
const lang = useRecoilValue(store.lang);
|
||||
|
|
@ -31,13 +27,6 @@ export default function Settings({ open, onOpenChange }) {
|
|||
window.addEventListener('resize', checkMobile);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (clearConvosMutation.isSuccess) {
|
||||
refreshConversations();
|
||||
newConversation();
|
||||
}
|
||||
}, [clearConvosMutation.isSuccess, newConversation, refreshConversations]);
|
||||
|
||||
useEffect(() => {
|
||||
// If the user clicks in the dialog when confirmClear is true, set it to false
|
||||
const handleClick = (e) => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import * as Tabs from '@radix-ui/react-tabs';
|
||||
import { CheckIcon } from 'lucide-react';
|
||||
import { ThemeContext } from '~/hooks/ThemeContext';
|
||||
import React, { useState, useContext, useCallback } from 'react';
|
||||
import React, { useState, useContext, useEffect, useCallback } from 'react';
|
||||
import { useClearConversationsMutation } from '@librechat/data-provider';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import store from '~/store';
|
||||
|
|
@ -70,6 +70,15 @@ function General() {
|
|||
const { theme, setTheme } = useContext(ThemeContext);
|
||||
const clearConvosMutation = useClearConversationsMutation();
|
||||
const [confirmClear, setConfirmClear] = useState(false);
|
||||
const { newConversation } = store.useConversation();
|
||||
const { refreshConversations } = store.useConversations();
|
||||
|
||||
useEffect(() => {
|
||||
if (clearConvosMutation.isSuccess) {
|
||||
newConversation();
|
||||
refreshConversations();
|
||||
}
|
||||
}, [clearConvosMutation.isSuccess, newConversation, refreshConversations]);
|
||||
|
||||
const clearConvos = useCallback(() => {
|
||||
if (confirmClear) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue