mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 21:43:59 +01:00
fix: keep folders expanded
This commit is contained in:
parent
a0c43a4ac0
commit
cb9f6fb3db
|
@ -59,9 +59,15 @@ const ChatFolder = ({
|
||||||
});
|
});
|
||||||
setChats(updatedChats);
|
setChats(updatedChats);
|
||||||
|
|
||||||
setFoldersName(
|
const updatedFoldersName = [...useStore.getState().foldersName];
|
||||||
useStore.getState().foldersName.filter((name) => name !== folderName)
|
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);
|
setIsDelete(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ const NewFolder = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const generating = useStore((state) => state.generating);
|
const generating = useStore((state) => state.generating);
|
||||||
const setFoldersName = useStore((state) => state.setFoldersName);
|
const setFoldersName = useStore((state) => state.setFoldersName);
|
||||||
|
const setFoldersExpanded = useStore((state) => state.setFoldersExpanded);
|
||||||
|
|
||||||
const addFolder = () => {
|
const addFolder = () => {
|
||||||
let folderIndex = 1;
|
let folderIndex = 1;
|
||||||
|
@ -23,6 +24,7 @@ const NewFolder = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
setFoldersName([name, ...useStore.getState().foldersName]);
|
setFoldersName([name, ...useStore.getState().foldersName]);
|
||||||
|
setFoldersExpanded([false, ...useStore.getState().foldersExpanded]);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue