-
Notifications
You must be signed in to change notification settings - Fork 540
Update PostHog import to use React hook #7135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Component
participant useTrack
participant usePostHog
participant PostHog
Component->>useTrack: Call useTrack()
useTrack->>usePostHog: Get PostHog instance
useTrack->>Component: Return tracking callback
Component->>useTrack: Invoke tracking callback (event, data)
useTrack->>PostHog: posthog?.capture(event, data)
PostHog-->>useTrack: (Optional: handle error silently)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (6)
🔇 Additional comments (5)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7135 +/- ##
=======================================
Coverage 55.63% 55.63%
=======================================
Files 902 902
Lines 58190 58190
Branches 4098 4098
=======================================
Hits 32373 32373
Misses 25712 25712
Partials 105 105
🚀 New features to boost your workflow:
|
size-limit report 📦
|
Merge activity
|
# Update PostHog import to use React hook This PR updates the PostHog implementation in the `useTrack` hook to use the React-specific hook from PostHog instead of the direct import. The changes include: - Replaced the direct import of `posthog` with `usePostHog` from `posthog-js/react` - Added the PostHog instance as a dependency to the `useCallback` hook - Added a null check before calling `posthog.capture()` to handle cases where PostHog might not be initialized These changes ensure proper React integration with PostHog and prevent potential issues with the hook's dependency array.
140d003
to
005acce
Compare
Update PostHog import to use React hook
This PR updates the PostHog implementation in the
useTrack
hook to use the React-specific hook from PostHog instead of the direct import. The changes include:posthog
withusePostHog
fromposthog-js/react
useCallback
hookposthog.capture()
to handle cases where PostHog might not be initializedThese changes ensure proper React integration with PostHog and prevent potential issues with the hook's dependency array.
PR-Codex overview
This PR updates the
useTrack
hook to use theusePostHog
hook fromposthog-js/react
instead of directly importingposthog
. It also modifies the dependency array for theuseCallback
hook to includeposthog
.Detailed summary
posthog
withusePostHog
fromposthog-js/react
.useCallback
hook to includeposthog
in its dependency array.capture
method is called onposthog
if it exists.Summary by CodeRabbit