mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 19:33:59 +01:00
fix: keep folders expanded
This commit is contained in:
parent
a0c43a4ac0
commit
cb9f6fb3db
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in a new issue