From e93076a413565278a73876da1b91174bd819643f Mon Sep 17 00:00:00 2001 From: sm-dstoll Date: Thu, 1 Feb 2024 11:55:59 -0800 Subject: [PATCH] updated DPChat to check for connected status before attempting to send ... --- .../soulmachines-react-app/src/routes/DPChat.js | 8 +++++--- .../soulmachines-react-app/src/routes/Loading.js | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/petstore/petstoreapp/soulmachines-react-app/src/routes/DPChat.js b/petstore/petstoreapp/soulmachines-react-app/src/routes/DPChat.js index 4b8edd2d..c865879c 100644 --- a/petstore/petstoreapp/soulmachines-react-app/src/routes/DPChat.js +++ b/petstore/petstoreapp/soulmachines-react-app/src/routes/DPChat.js @@ -63,9 +63,11 @@ function DPChat({ useEffect(() => { // send init event, since we will finish loading before we display the DP - setTimeout(() => { - dispatch(sendTextMessage({ text: '...' })); - }, 5000); + if (connected) { + setTimeout(() => { + dispatch(sendTextMessage({ text: '...' })); + }, 2500); + } // run resize once on mount, then add listener for future resize events handleResize(); window.addEventListener('resize', handleResize); diff --git a/petstore/petstoreapp/soulmachines-react-app/src/routes/Loading.js b/petstore/petstoreapp/soulmachines-react-app/src/routes/Loading.js index dab19faf..3f8293f2 100644 --- a/petstore/petstoreapp/soulmachines-react-app/src/routes/Loading.js +++ b/petstore/petstoreapp/soulmachines-react-app/src/routes/Loading.js @@ -157,7 +157,11 @@ function Loading({ }; const history = useHistory(); useEffect(() => { - if (skip === true && connected === true) history.push('/video'); + if (skip === true && connected === true) { + setTimeout(() => { + history.push('/video'); + }, 2500); + } }, [connected, skip]); return (