Skip to content

fix(site): ThumbnailDisplay breaks when variant mixes video + image#803

Merged
dante01yoon merged 10 commits intomainfrom
fix/thumbnail-display-video-webp-mismatch
Apr 22, 2026
Merged

fix(site): ThumbnailDisplay breaks when variant mixes video + image#803
dante01yoon merged 10 commits intomainfrom
fix/thumbnail-display-video-webp-mismatch

Conversation

@dante01yoon
Copy link
Copy Markdown
Contributor

Summary

Fixes the broken second player on template pages like templates_ingi_infl8-06caca08d30b reported in Slack.

Root cause

ThumbnailDisplay.astro decided its render branch based on only the primary thumb's type (isVideo = isVideoFile(primaryThumb), ThumbnailDisplay.astro:56) and then rendered the secondary thumb as a <video> too, regardless of its actual extension. For the affected template the primary is .mp4 and the secondary is .webp, so a <video> was emitted with a webp URL as src — which browsers can't play, and which additionally 404s from the CDN.

The built-in video-fallback safety net also failed: secondaryVideoPosterUrl was null (webp isn't a video), so no <img data-video-fallback-img> was rendered, and the script's if (!fallbackImg) return (ThumbnailDisplay.astro:300) bailed before attaching any error/stalled listeners. The result was a blank, broken second player.

Note: there is also an upstream data issue (a compareSlider/image_comparison entry paired a video with a missing image) — that fix belongs to the admin/publish pipeline, not this repo. This PR hardens the frontend so the same shape doesn't render a broken element in the future.

Changes

  • Add isSecondaryVideo so each thumb is dispatched on its own type.
  • If the secondary is not a video, render it as <img> instead of <video>.
  • Videos without a fallback poster now hide the wrapper on error instead of silently failing.
  • Image thumbs hide themselves on load error to swallow CDN 404s.

Test plan

  • Visit the affected page — only the mp4 video should render; the broken 404 element should be hidden
  • Check that existing video-only templates (primary + secondary both mp4) still render two video players with posters
  • Check that compareSlider templates with two image thumbs still render the draggable slider
  • Check hoverDissolve / zoomHover / default templates render unchanged
  • Run pnpm run check in site/ — 0 errors

- Use shareId instead of name as MiniSearch document ID since name can
  be duplicated across different users' workflows
- Store slug (name-shareId) in search index for correct URL routing
- Make Phase 2 prebuild failures fatal so broken builds don't deploy
- Change cron rebuild interval from 15min to 30min
…lbacks

- search.ts: add name/slug to WorkflowHit, use allowedNames for badge filtering
- SearchPopover: use hit.slug for URLs, allowedNames for badge scoping
- build-index.ts: throw on hub API failure instead of silent fallback
- hub-api.ts: add loadSerializedTemplates() that fails build when hub API
  is configured but unavailable (no silent content collection fallback)
- Replace 8 duplicate try/catch fallback blocks across astro pages with
  the shared loadSerializedTemplates() helper
- Use slug (name-shareId) for popular workflow links to avoid 301 redirect
- Remove unnecessary `as any` casts on typed `usage` field
- Improve fallback console.warn to preserve error diagnostics
- Add JSDoc to fetchIndexEntries() documenting null vs throw semantics
- Rename shadowed `t` parameter to `tmpl` in category page filters
…ered as video

ThumbnailDisplay branched on the primary thumb's media type and then
assumed the secondary shared that type, so an image-typed secondary was
rendered inside a <video> element. When the secondary URL also 404'd
(as on templates_ingi_infl8-06caca08d30b), the JS fallback bailed early
because no fallback <img> had been emitted, leaving blank controls.

- Add isSecondaryVideo check and render the secondary as <img> when it
  is not a video.
- Videos without an available poster now hide the wrapper on error
  instead of silently failing.
- Image secondaries hide themselves on load error to swallow CDN 404s.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

🧹 Lint & Format Results

Check Status
ESLint ✅ success
Prettier ✅ success

Generated by Site CI workflow

… fix)

The removed 'if (!fallbackImg) return' early-out / wrapper-hide branch
is separate hardening for posterless videos and was not needed for the
reported bug. With the per-type dispatch, the secondary is rendered as
<img>, so no posterless <video> path is introduced by this PR.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

🔍 SEO Audit Results

Check Status
Sitemap Validation ✅ passed
SEO Audit ✅ passed
Internal Links ❓ skipped
📊 SEO Audit Details

Could not parse SEO output

🔗 Link Check Details

broken internal links out of checked


Generated by Site CI workflow

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Preview deployed: https://workflow-templates-nvda1ulhx-comfyui.vercel.app

@dante01yoon dante01yoon merged commit 759ef35 into main Apr 22, 2026
15 checks passed
@dante01yoon dante01yoon deleted the fix/thumbnail-display-video-webp-mismatch branch April 22, 2026 22:32
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