clear all convos in progress, async code refactored in debugging warning

This commit is contained in:
Daniel Avila 2023-02-07 19:07:48 -05:00
parent 053368646d
commit 511ac948b4
10 changed files with 84 additions and 65 deletions

View file

@ -11,17 +11,14 @@ export default function Conversation({ id, parentMessageId, title = 'New convers
const conversationId = useSelector((state) => state.convo.conversationId);
const { trigger, isMutating } = manualSWR(
`http://localhost:3050/messages/${id}`,
'get',
(res) => dispatch(setMessages(res))
'get'
);
const clickHandler = () => {
if (conversationId === id) {
return;
}
const clickHandler = async () => {
dispatch(setConversation({ conversationId: id, parentMessageId }));
trigger();
const data = await trigger();
dispatch(setMessages(data));
};
return (