Skip to content

skip preview image for video#2282

Merged
ragnep merged 1 commit intomainfrom
video-fix-grid-view
Apr 16, 2026
Merged

skip preview image for video#2282
ragnep merged 1 commit intomainfrom
video-fix-grid-view

Conversation

@ragnep
Copy link
Copy Markdown
Contributor

@ragnep ragnep commented Apr 16, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved media display handling in the leaderboard gallery to correctly identify and render different media types (images and videos) with appropriate fallbacks.

Signed-off-by: ragnep <ragneinfo@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

📝 Walkthrough

Walkthrough

The component refactors media property access by extracting primaryMedia from drop.parts[0]?.media[0] and conditionally memoizing previewImageUrl to null for videos while using getDropPreviewImageUrl(drop.metadata) otherwise. Child component props are updated to consume media properties directly from primaryMedia with fallback values.

Changes

Cohort / File(s) Summary
Media Property Refactoring
components/waves/leaderboard/gallery/WaveLeaderboardGalleryItem.tsx
Extracts primaryMedia from drop structure and computes isPrimaryMediaVideo based on mime type. Conditionally sets previewImageUrl to null for videos, otherwise derives from getDropPreviewImageUrl(). Updates MediaDisplay and MediaTypeBadge props to consume primaryMedia properties with safe fallbacks instead of non-null assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #2167: Modifies media metadata and preview image/iframe prop derivation and forwarding into MediaDisplay.
  • #2138: Adjusts MediaDisplay prop propagation with previewImageUrl and interaction-gating behavior for media handling.
  • #1876: Modifies previewImageUrl derivation using getDropPreviewImageUrl() and adjusts MediaDisplay prop passing patterns.

Suggested reviewers

  • simo6529
  • prxt6529

Poem

🐰 Media props now flow with grace,
Primary media finds its place,
Videos skip the preview show,
With fallbacks safe, we gently go! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'skip preview image for video' directly describes the main change: memoizing previewImageUrl to null for video media while keeping it for other media types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch video-fix-grid-view

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 and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/waves/leaderboard/gallery/WaveLeaderboardGalleryItem.tsx`:
- Line 47: The expression computing isPrimaryMediaVideo can throw when
primaryMedia or its mime_type is undefined; update the check in
WaveLeaderboardGalleryItem (the isPrimaryMediaVideo constant) to safely guard
the startsWith call by using optional chaining on mime_type and a safe default
(e.g., treat undefined as false) so that no TypeError occurs when primaryMedia
or primaryMedia.mime_type is missing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 50e92dab-f21c-4c44-8d35-76b3dc63201b

📥 Commits

Reviewing files that changed from the base of the PR and between 18287c9 and 9fe7da3.

📒 Files selected for processing (1)
  • components/waves/leaderboard/gallery/WaveLeaderboardGalleryItem.tsx

Comment thread components/waves/leaderboard/gallery/WaveLeaderboardGalleryItem.tsx
@ragnep ragnep merged commit f04d0f8 into main Apr 16, 2026
8 checks passed
@ragnep ragnep deleted the video-fix-grid-view branch April 16, 2026 05:53
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