diff --git a/src/components/Menu/ChatFolder.tsx b/src/components/Menu/ChatFolder.tsx index 43bb16e..ee9245f 100644 --- a/src/components/Menu/ChatFolder.tsx +++ b/src/components/Menu/ChatFolder.tsx @@ -59,9 +59,15 @@ const ChatFolder = ({ }); setChats(updatedChats); - setFoldersName( - useStore.getState().foldersName.filter((name) => name !== folderName) - ); + const updatedFoldersName = [...useStore.getState().foldersName]; + const updatedFoldersExpanded = [...useStore.getState().foldersExpanded]; + + const i = updatedFoldersName.findIndex((name) => name === folderName); + updatedFoldersName.splice(i, 1); + updatedFoldersExpanded.splice(i, 1); + + setFoldersName(updatedFoldersName); + setFoldersExpanded(updatedFoldersExpanded); setIsDelete(false); }; diff --git a/src/components/Menu/NewFolder.tsx b/src/components/Menu/NewFolder.tsx index b811e2c..65ab7d6 100644 --- a/src/components/Menu/NewFolder.tsx +++ b/src/components/Menu/NewFolder.tsx @@ -8,6 +8,7 @@ const NewFolder = () => { const { t } = useTranslation(); const generating = useStore((state) => state.generating); const setFoldersName = useStore((state) => state.setFoldersName); + const setFoldersExpanded = useStore((state) => state.setFoldersExpanded); const addFolder = () => { let folderIndex = 1; @@ -23,6 +24,7 @@ const NewFolder = () => { } setFoldersName([name, ...useStore.getState().foldersName]); + setFoldersExpanded([false, ...useStore.getState().foldersExpanded]); }; return (