mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
make sure analytics is setup before calling show on Intercom
This commit is contained in:
parent
22a5850c1e
commit
fcef8e14e7
1 changed files with 12 additions and 2 deletions
|
|
@ -1,11 +1,21 @@
|
|||
import { useEffect } from 'react'
|
||||
import { useEffect, useCallback } from 'react'
|
||||
import { SettingsLayout } from '../components/templates/SettingsLayout'
|
||||
import { setupAnalytics } from '../lib/analytics'
|
||||
|
||||
export default function Support(): JSX.Element {
|
||||
useEffect(() => {
|
||||
const initAnalytics = useCallback(() => {
|
||||
setupAnalytics()
|
||||
window.Intercom('show')
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
initAnalytics()
|
||||
window.addEventListener('load', initAnalytics)
|
||||
return () => {
|
||||
window.removeEventListener('load', initAnalytics)
|
||||
}
|
||||
}, [initAnalytics])
|
||||
|
||||
return (
|
||||
<SettingsLayout title="Support">
|
||||
<></>
|
||||
|
|
|
|||
Loading…
Reference in a new issue