From 682190dec010f45d6d25ec1575aa2ad5acf8849e Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 27 Feb 2023 17:32:18 -0300 Subject: [PATCH] flow tabs bug solved with variable control inside chat] --- space_flow/src/components/chatComponent/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/space_flow/src/components/chatComponent/index.tsx b/space_flow/src/components/chatComponent/index.tsx index d001f26c5..9a6ec63f7 100644 --- a/space_flow/src/components/chatComponent/index.tsx +++ b/space_flow/src/components/chatComponent/index.tsx @@ -15,6 +15,7 @@ const _ = require("lodash"); export default function Chat({flow, reactFlowInstance }) { const {updateFlow} = useContext(TabsContext) + const [saveChat,setSaveChat] = useState(false) const [open, setOpen] = useState(true); const [chatValue, setChatValue] = useState(""); const [chatHistory, setChatHistory] = useState(flow.chat); @@ -25,14 +26,16 @@ export default function Chat({flow, reactFlowInstance }) { newChat.push({ message, isSend }); return newChat; }); + setSaveChat(chat=>!chat) }; //bug here why?? useEffect(()=>{ + console.log("flow") updateFlow({..._.cloneDeep(flow),chat:chatHistory}) - },[chatHistory]) + },[saveChat]) useEffect(()=>{ setChatHistory(flow.chat) - console.log(flow.chat) + // console.log(flow.chat) },[flow]) useEffect(()=>{ if(ref.current)