🩹(frontend) prevent an error if crisp is not defined

While hot reloading the stack, I got an error, Crisp not being
defined at the time of the component rendering. Prevent such issue.
I am not 100% sure this commit is useful, WDYT?
This commit is contained in:
lebaudantoine
2024-12-02 17:36:57 +01:00
committed by aleb_the_flash
parent 60b7a35ed1
commit a299cae8e8

View File

@@ -9,6 +9,10 @@ export const SupportToggle = () => {
const [isOpened, setIsOpened] = useState($crisp.is('chat:opened'))
useEffect(() => {
if (!Crisp) {
return
}
Crisp.chat.onChatOpened(() => {
setIsOpened(true)
})