Skip to content

Restore static preview-image fallback for html#2166

Merged
prxt6529 merged 1 commit intomainfrom
html-preview-fallback-fix
Mar 25, 2026
Merged

Restore static preview-image fallback for html#2166
prxt6529 merged 1 commit intomainfrom
html-preview-fallback-fix

Conversation

@prxt6529
Copy link
Copy Markdown
Collaborator

@prxt6529 prxt6529 commented Mar 25, 2026

Summary by CodeRabbit

  • Bug Fixes

    • HTML media now displays preview images by default instead of loading interactive content immediately when preview images are available.
  • Tests

    • Added test coverage for HTML media preview image rendering and interactive load behavior.

Signed-off-by: prxt6529 <prxt@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a6448694-1e3e-4816-a6ac-40207c9eed43

📥 Commits

Reviewing files that changed from the base of the PR and between 31b731d and dd059e9.

📒 Files selected for processing (2)
  • __tests__/components/drops/view/item/content/media/MediaDisplay.test.tsx
  • components/drops/view/item/content/media/MediaDisplay.tsx

📝 Walkthrough

Walkthrough

This PR optimizes HTML media rendering in the MediaDisplay component. When a preview image URL is available and interaction is not required, the component now renders the preview image directly instead of the interactive iframe display. Test coverage for this behavior is added.

Changes

Cohort / File(s) Summary
Test additions
__tests__/components/drops/view/item/content/media/MediaDisplay.test.tsx
Added two test cases validating that HTML media with previewImageUrl renders the preview image instead of iframe by default, and verifying correct behavior when requireInteractionToLoad is also set.
Component logic
components/drops/view/item/content/media/MediaDisplay.tsx
Modified HTML media rendering to check for previewImageUrl and requireInteractionToLoad flag; when preview is available and interaction is not required, renders the preview image directly rather than the interactive display.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #1876 — Begins passing previewImageUrl to MediaDisplay with interaction disabled, complementing this PR's rendering logic for preview-based display.
  • #2138 — Modifies the same HTML media rendering and interaction-gating logic in MediaDisplay, handling preview image and iframe behavior.

Suggested reviewers

  • ragnep
  • simo6529

Poem

🐰 A preview peeks from HTML's den,
No iframe loads until we ask again.
Swift and tidy, the logic flows,
Less interaction than before—hooray! ✨

🚥 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 'Restore static preview-image fallback for html' directly and accurately describes the main change: restoring the ability for HTML media to display a static preview image instead of always requiring an interactive iframe.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 html-preview-fallback-fix

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

@prxt6529 prxt6529 merged commit df0ad63 into main Mar 25, 2026
8 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 25, 2026
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.

3 participants