feat: improve site performance and unify analytics - #87
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideThis PR unifies analytics across Remco, PostHog, and Vercel while reducing motion/analytics runtime in the initial bundle by lazy-loading heavy UI (contact/resume drawers) and replacing motion/react hooks with lightweight custom hooks, alongside small layout, accessibility, and styling refinements and removal of unused dependencies. Sequence diagram for lazy-loading footer drawerssequenceDiagram
actor User
participant Trigger as Footer trigger
participant Loader as Lazy loader
participant Drawer as Contact or resume drawer
User->>Trigger: onPointerEnter or onFocus
Trigger->>Loader: setLoad(true)
Loader->>Drawer: Import component
User->>Trigger: onClick
Trigger->>Loader: setLoad(true), setOpen(true)
Loader->>Drawer: Render with initialOpen=true
Flow diagram for motion-free viewport animation hooksflowchart LR
Component[AnimatedNumber or stagger layer] --> InView[useInViewOnce]
InView --> Observer[IntersectionObserver]
Observer --> Visible[Enable animation once visible]
Component --> Reduced[useReducedMotion]
Reduced --> MediaQuery[prefers-reduced-motion]
MediaQuery --> Motion[Respect reduced motion preference]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📝 Changed routes:
Commit ea60601 (https://remcostoeten-o5uqr9rzr-remcostoetens-projects.vercel.app). |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/components/contact/lazy-contact-popover.tsx" line_range="22-25" />
<code_context>
+ <div className="relative inline-block text-left">
+ <button
+ type="button"
+ aria-haspopup="dialog"
+ aria-expanded={false}
+ onPointerEnter={onLoad}
+ onFocus={onLoad}
+ onClick={onOpen}
+ className="text-muted-foreground hover:text-foreground transition-colors text-sm font-medium"
</code_context>
<issue_to_address>
**issue (bug_risk):** The lazy contact trigger hard-codes `aria-expanded={false}`, and the resume trigger exposes no expanded state at all; while the lazy module is loading after activation, assistive technology is told that the control is closed even though the user has requested it to open.
**Triggers:** When a user activates the trigger before its lazy module has finished loading.
**Suggested fix:** Pass the open state into `Trigger` and expose it through `aria-expanded` (and an appropriate relationship to the pending dialog/drawer).
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and this changes production behavior to automatically send pageview, performance, scroll, time-on-page, and PostHog telemetry to external analytics services. Reverting stops future collection but cannot retract data already transmitted and retained by those services.
Blocking findings: src/components/contact/lazy-contact-popover.tsx:25
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| aria-haspopup="dialog" | ||
| aria-expanded={false} | ||
| onPointerEnter={onLoad} | ||
| onFocus={onLoad} |
There was a problem hiding this comment.
issue (bug_risk): The lazy contact trigger hard-codes aria-expanded={false}, and the resume trigger exposes no expanded state at all; while the lazy module is loading after activation, assistive technology is told that the control is closed even though the user has requested it to open.
Triggers: When a user activates the trigger before its lazy module has finished loading.
Suggested fix: Pass the open state into Trigger and expose it through aria-expanded (and an appropriate relationship to the pending dialog/drawer).

Summary
Validation
Summary by Sourcery
Improve site performance and consolidate analytics across supported providers.
New Features:
Enhancements:
Build: