From 48a49761672b65a0b7d14aeee5b1208077a37061 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Sat, 18 Jun 2022 10:27:48 +0200 Subject: [PATCH] =?UTF-8?q?fix(bot):=20=F0=9F=90=9B=20Avoid=20chat=20to=20?= =?UTF-8?q?start=20multiple=20times?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/bot-engine/src/components/ConversationContainer.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/bot-engine/src/components/ConversationContainer.tsx b/packages/bot-engine/src/components/ConversationContainer.tsx index 4eff0b1b1..e37f43149 100644 --- a/packages/bot-engine/src/components/ConversationContainer.tsx +++ b/packages/bot-engine/src/components/ConversationContainer.tsx @@ -44,6 +44,7 @@ export const ConversationContainer = ({ const { updateVariables } = useAnswers() const bottomAnchor = useRef(null) const scrollableContainer = useRef(null) + const [hasStarted, setHasStarted] = useState(false) const displayNextGroup = ({ edgeId, @@ -90,6 +91,7 @@ export const ConversationContainer = ({ } useEffect(() => { + if (hasStarted) return if ( isDefined(predefinedVariables) && Object.keys(predefinedVariables).length > 0 @@ -97,6 +99,7 @@ export const ConversationContainer = ({ const prefilledVariables = injectPredefinedVariables(predefinedVariables) updateVariables(prefilledVariables) } + setHasStarted(true) displayNextGroup({ edgeId: startGroupId ? undefined