From 9fe85cd9133f99becef4e32b8354375c66364d0a Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Fri, 25 Mar 2022 10:44:18 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Support=20bubble=20closes?= =?UTF-8?q?=20on=20save?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StepNodeContent/contents/TextBubbleContent.tsx | 2 +- apps/builder/components/shared/SupportBubble.tsx | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/builder/components/shared/Graph/Nodes/StepNode/StepNodeContent/contents/TextBubbleContent.tsx b/apps/builder/components/shared/Graph/Nodes/StepNode/StepNodeContent/contents/TextBubbleContent.tsx index 09e67f612..aa149b3e0 100644 --- a/apps/builder/components/shared/Graph/Nodes/StepNode/StepNodeContent/contents/TextBubbleContent.tsx +++ b/apps/builder/components/shared/Graph/Nodes/StepNode/StepNodeContent/contents/TextBubbleContent.tsx @@ -13,7 +13,7 @@ export const TextBubbleContent = ({ step }: Props) => { if (!typebot) return <> return ( { const { typebot } = useTypebot() const { user } = useUser() + const [localTypebotId, setLocalTypebotId] = useState(typebot?.id) + const [localUserId, setLocalUserId] = useState(user?.id) useEffect(() => { - if (isCloudProdInstance()) + if ( + isCloudProdInstance() && + (localTypebotId !== typebot?.id || localUserId !== user?.id) + ) { + setLocalTypebotId(typebot?.id) + setLocalUserId(user?.id) initBubble({ url: `${ process.env.NEXT_PUBLIC_VIEWER_INTERNAL_URL ?? @@ -32,6 +39,7 @@ export const SupportBubble = () => { Plan: planToReadable(user?.plan), }, }) + } // eslint-disable-next-line react-hooks/exhaustive-deps }, [user, typebot])