Skip to content

Commit

Permalink
fix: 🐛 Support bubble closes on save
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 25, 2022
1 parent b784e89 commit 9fe85cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const TextBubbleContent = ({ step }: Props) => {
if (!typebot) return <></>
return (
<Flex
isTruncated
w="90%"
flexDir={'column'}
opacity={step.content.html === '' ? '0.5' : '1'}
className="slate-html-container"
Expand Down
12 changes: 10 additions & 2 deletions apps/builder/components/shared/SupportBubble.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import { useTypebot } from 'contexts/TypebotContext'
import { useUser } from 'contexts/UserContext'
import { Plan } from 'db'
import React, { useEffect } from 'react'
import React, { useEffect, useState } from 'react'
import { isCloudProdInstance } from 'services/utils'
import { initBubble } from 'typebot-js'

export const SupportBubble = () => {
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 ??
Expand All @@ -32,6 +39,7 @@ export const SupportBubble = () => {
Plan: planToReadable(user?.plan),
},
})
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [user, typebot])

Expand Down

3 comments on commit 9fe85cd

@vercel
Copy link

@vercel vercel bot commented on 9fe85cd Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 9fe85cd Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

Please sign in to comment.