Repository navigation
[docs] Clean up timeout handling in useEffect in GoogleAnalyticsProvider - #5760
Conversation
|
@claude review |
PR reviewThe change is behavior-preserving for the real flows: the old Bugs (1)1. ℹ️ Pending
|
commit: |
Bundle size
PerformanceTotal duration: 930.42 ms +25.65 ms(+2.8%) | Renders: 76 (+0) | Paint: 1,562.16 ms +41.76 ms(+2.7%)
14 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The raw timer should use the repository’s shared useTimeout utility.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Simplifies delayed Google Analytics page-view tracking cleanup.
Changes:
- Replaces the persistent timeout ref with effect-local cleanup.
| File | Description |
|---|---|
docs/src/blocks/GoogleAnalyticsProvider.tsx |
Cleans up the page-view timeout when the effect reruns or unmounts. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| userLanguage, | ||
| children, | ||
| }: GoogleAnalyticsProviderProps) { | ||
| const timeout = useTimeout(); |
There was a problem hiding this comment.
Used repo level utility instead of raw setTimeOut
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new React.useCallback conflicts with the repository’s callback convention.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (1)
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The extra dependency argument passed to useStableCallback causes a TypeScript error.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1


I ran
npx react-doctor@latestfrom React Doctor in thedocsfolder. It scans the codebase for inefficient React patterns and potential improvements.It identified a bunch of issues, and I’ll be creating separate PRs to address them. This is the first PR in that series.
React Doctor identified timer without cleanup in docs/src/blocks/GoogleAnalyticsProvider.tsx, This PR addresses that issue