From 3e59c9f820c358bc930a03b2c9843278fb9652a3 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 24 Feb 2023 17:37:04 -0300 Subject: [PATCH] scrollIntoView bug solved --- space_flow/src/components/chatComponent/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/space_flow/src/components/chatComponent/index.tsx b/space_flow/src/components/chatComponent/index.tsx index 26b7b61b2..f227bc66b 100644 --- a/space_flow/src/components/chatComponent/index.tsx +++ b/space_flow/src/components/chatComponent/index.tsx @@ -34,7 +34,8 @@ export default function Chat({flow, reactFlowInstance }) { console.log(flow.chat) },[flow]) useEffect(()=>{ - ref.current.scrollIntoView({behavior: 'smooth'}); + if(ref.current) + ref.current.scrollIntoView({behavior: 'smooth'}); }, [chatHistory]) function validateNodes(){ if(reactFlowInstance.getNodes().some((n) => (n.data.node && Object.keys(n.data.node.template).some((t: any) => ((n.data.node.template[t].required && n.data.node.template[t].value === "") && (n.data.node.template[t].required && !reactFlowInstance.getEdges().some((e) => (e.sourceHandle.split('|')[1] === t && e.sourceHandle.split('|')[2] === n.id)))))))){