-
Notifications
You must be signed in to change notification settings - Fork 596
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
disable analytics.page() when url tracking disabled #4801
Conversation
WalkthroughThe changes introduce a new test suite for the Changes
Possibly related PRs
Suggested reviewers
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (2)
Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (2)
app/packages/analytics/src/usingAnalytics.ts (1)
96-96
: LGTM: Effective implementation of URL tracking disableThe update to the
page
method successfully implements the PR objective by preventing thesegment.page()
call when URL tracking is disabled. The condition is well-placed alongside the existing check.For improved readability, consider using parentheses to group the conditions:
if (!this._segment || this._disableUrlTracking) return;This change would make the condition more explicit and easier to understand at a glance.
app/packages/analytics/src/analytics.test.ts (1)
210-233
: LGTM! Consider adding an assertion for the page name.The new test suite for
analytics.page()
is well-structured and covers both the default behavior and the case when URL tracking is disabled. Good job on improving the test coverage!Consider adding an assertion in the first test case to verify that
mockSegment.page
is called with the correct page name:expect(mockSegment.page).toHaveBeenCalledWith("my_page");This would ensure that the page name is correctly passed to the underlying segment library.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- app/packages/analytics/src/analytics.test.ts (1 hunks)
- app/packages/analytics/src/usingAnalytics.ts (2 hunks)
Additional context used
Path-based instructions (2)
app/packages/analytics/src/analytics.test.ts (1)
Pattern
**/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.app/packages/analytics/src/usingAnalytics.ts (1)
Pattern
**/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
Additional comments not posted (1)
app/packages/analytics/src/usingAnalytics.ts (1)
35-35
: LGTM: New property for disabling URL trackingThe addition of the
_disableUrlTracking
property with a default value offalse
and a clear comment explaining its purpose is a good implementation. It aligns well with the PR objective and provides a way to control URL tracking behavior.
f7d7a10
to
5209940
Compare
What changes are proposed in this pull request?
Disables the
segment.page()
call whendisableUrlTracking
istrue
.How is this patch tested? If it is not, please explain why.
Added an automated test.
Summary by CodeRabbit