only start a new thread if empty

This commit is contained in:
Andrew 2024-10-11 20:05:10 -07:00
parent e04d839640
commit 2638d62a24

View file

@ -157,7 +157,8 @@ const Sidebar = () => {
// if they pressed the + to add a new chat
else if (m.type === 'startNewThread') {
setIsThreadSelectorOpen(false)
startNewThread()
if (currentThread?.messages.length !== 0)
startNewThread()
}
// if they opened thread selector
@ -168,7 +169,7 @@ const Sidebar = () => {
}
window.addEventListener('message', listener);
return () => { window.removeEventListener('message', listener) }
}, [files, selection, startNewThread])
}, [files, selection, startNewThread, currentThread])
const formRef = useRef<HTMLFormElement | null>(null)