mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 21:34:00 +01:00
fix migration from old to new ChatInterface
This commit is contained in:
parent
a009be9986
commit
5372c48f53
|
@ -30,10 +30,9 @@ const ChatTitle = React.memo(() => {
|
||||||
|
|
||||||
// for migrating from old ChatInterface to new ChatInterface (with config)
|
// for migrating from old ChatInterface to new ChatInterface (with config)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!config) {
|
const chats = useStore.getState().chats;
|
||||||
const updatedChats: ChatInterface[] = JSON.parse(
|
if (chats && chats.length > 0 && currentChatIndex !== -1 && !config) {
|
||||||
JSON.stringify(useStore.getState().chats)
|
const updatedChats: ChatInterface[] = JSON.parse(JSON.stringify(chats));
|
||||||
);
|
|
||||||
updatedChats[currentChatIndex].config = { ...defaultChatConfig };
|
updatedChats[currentChatIndex].config = { ...defaultChatConfig };
|
||||||
setChats(updatedChats);
|
setChats(updatedChats);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue