🩹(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:
committed by
aleb_the_flash
parent
60b7a35ed1
commit
a299cae8e8
@@ -9,6 +9,10 @@ export const SupportToggle = () => {
|
|||||||
const [isOpened, setIsOpened] = useState($crisp.is('chat:opened'))
|
const [isOpened, setIsOpened] = useState($crisp.is('chat:opened'))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!Crisp) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
Crisp.chat.onChatOpened(() => {
|
Crisp.chat.onChatOpened(() => {
|
||||||
setIsOpened(true)
|
setIsOpened(true)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user