Closed benjackwhite closed 9 months ago
A couple of users have reported that when devving locally, opening the developer tools (chrome) causes the app to crash. It seems to be related to the use of native sync calls probably coming from our use of device-info https://github.com/react-native-device-info/react-native-device-info/issues/776
One user documented their workaround that we should either also implement or (ideally) workaround
/** https://stackoverflow.com/a/60041699 */ const WITH_CHROME_DEBUGGER = !global.nativeCallSyncHook; /** Posthog causes a crash in Chrome debug thus we disable it if chrome debugger is on */ export const DISABLE_POSTHOG = __DEV__ && WITH_CHROME_DEBUGGER; export const isPosthogDisabled = ( _posthogPromise: Promise<PostHog> | Promise<undefined> ): _posthogPromise is Promise<undefined> => { return DISABLE_POSTHOG; }; const posthogPromise = DISABLE_POSTHOG ? Promise.resolve(undefined) : PostHog.initAsync(POSTHOG_API_KEY, { host: POSTHOG_HOST }) const SharedPosthogProvider: FC = ({ children }) => { useLifecycleTracker(); if (isPosthogDisabled(posthogPromise)) { console.warn(`Posthog tracking is disabled.`); return <>{children}</>; } return ( <PostHogProvider client={posthogPromise} autocapture={{ captureLifecycleEvents: false, captureTouches: true, }} > {children} </PostHogProvider> ); };
https://github.com/PostHog/posthog.com/pull/7902/files You can check the Disabling for local development section, not been published yet though.
Disabling for local development section
Bug description
A couple of users have reported that when devving locally, opening the developer tools (chrome) causes the app to crash. It seems to be related to the use of native sync calls probably coming from our use of device-info https://github.com/react-native-device-info/react-native-device-info/issues/776
One user documented their workaround that we should either also implement or (ideally) workaround
Related sub-libraries
Additional context
Thank you for your bug report – we love squashing them!