Skip to content

perf: avoid unnecessary homepage hero downloads - #1308

Merged
LadyBluenotes merged 1 commit into
TanStack:mainfrom
LadyBluenotes:perf/hero-media-loading
Sep 30, 2026
Merged

LadyBluenotes merged 1 commit into
TanStack:mainfrom
LadyBluenotes:perf/hero-media-loading

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Keep the responsive hero image visible and attach the video source only after the browser permits motion. Remove the redundant JPEG poster request.

Preserve autoplay, loop, mute, inline playback, keyboard pause/resume, and pause when reduced motion is enabled. Playback failures keep the still image visible, report the error, and allow a later retry.

Loading difference: video activation now waits for hydration. Visitors without JavaScript retain the still image.

Checks

  • Chrome tests cover server-rendered markup, hydration, zero initial MP4 requests with reduced motion, no JPEG request, preference changes, keyboard controls, failures, and retries.
  • Full pnpm test and normal commit hooks passed.
  • Production build, TypeScript, targeted lint, formatting, and diff checks passed.
  • Safari and Firefox were not tested.

Summary by CodeRabbit

  • New Features
    • Added video media to the homepage hero, with a still image shown while the video loads.
    • Video playback respects reduced-motion preferences and can be started or paused with an on-screen control.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f630415b-2a7d-4a06-8df3-d0308c82e111

📥 Commits

Reviewing files that changed from the base of the PR and between 543f740 and 443e06d.

📒 Files selected for processing (3)
  • src/components/home/HeroPalmMedia.tsx
  • src/routes/index.tsx
  • tests/hero-media.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The homepage now imports HeroPalmMedia from a home component module. The component renders a responsive image and video, handles reduced-motion preferences, and provides playback controls. New tests cover server-rendered markup and browser behavior.

Changes

Homepage hero media

Layer / File(s) Summary
Hero media implementation, homepage wiring, and tests
src/components/home/HeroPalmMedia.tsx, src/routes/index.tsx, tests/hero-media.test.ts
The extracted component manages video source loading, playback state, and reduced-motion behavior. The homepage route imports the component. Tests cover server rendering, browser playback, preference changes, and failed playback or requests.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 443e0

The hero defers video loading while retaining its still-image fallback. No actionable new failure was established; the change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reducing unnecessary downloads for the homepage hero media.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LadyBluenotes
LadyBluenotes merged commit 0494b35 into TanStack:main Sep 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants