Skip to content

Fix thumbnail not loading for newly created sites (approach 1) - #2474

Closed
ivan-ottinger wants to merge 3 commits into
trunkfrom
fix/STU-1212-newly-added-site-thumbnail
Closed

Fix thumbnail not loading for newly created sites (approach 1)#2474
ivan-ottinger wants to merge 3 commits into
trunkfrom
fix/STU-1212-newly-added-site-thumbnail

Conversation

@ivan-ottinger

Copy link
Copy Markdown
Contributor

Summary

  • Fixes an issue where newly created sites would show "Preview unavailable" instead of loading the thumbnail
  • The thumbnail would only appear after navigating away and back to the Overview tab
  • Root cause: the error state was set when the img tried to load with empty src, and could never be reset because the img was replaced by a div

Changes

  • Added thumbnailLoadErrors tracking at the context level in use-theme-details.tsx
  • Added a useEffect to reset local error state when thumbnail loading starts
  • Updated loading condition to show skeleton for running sites without thumbnail data (unless a load error occurred)

Test plan

  • Create a new site
  • Verify the thumbnail loads without needing to navigate away
  • Verify existing sites still show thumbnails correctly
  • Verify "Preview unavailable" still shows when thumbnail generation actually fails

Fixes STU-1212

🤖 Generated with Claude Code

@ivan-ottinger ivan-ottinger self-assigned this Jan 26, 2026
When a new site was created, the thumbnail would show "Preview unavailable"
until the user navigated away and back. This happened because:

1. The img element would try to load with an empty src before thumbnail data
   arrived, triggering onError and setting isThumbnailError to true
2. Once isThumbnailError was true, the img was replaced by a div, so onLoad
   could never fire to reset the error state when data arrived

This fix:
- Adds thumbnailLoadErrors tracking at the context level to distinguish
  between "no data yet" and "failed to load"
- Resets the local error state when a new thumbnail load starts
- Shows the loading skeleton for running sites until thumbnail data arrives
  or a load error occurs

Fixes STU-1212

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ivan-ottinger
ivan-ottinger force-pushed the fix/STU-1212-newly-added-site-thumbnail branch from 0586f39 to 470b21e Compare January 27, 2026 11:01
@ivan-ottinger ivan-ottinger changed the title Fix thumbnail not loading for newly created sites Jan 27, 2026
@ivan-ottinger

Copy link
Copy Markdown
Contributor Author

Closing in favor of #2484.

@wojtekn
wojtekn deleted the fix/STU-1212-newly-added-site-thumbnail branch February 2, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant