Skip to content

Fix site thumbnail not refreshing after content changes#2549

Merged
sejas merged 4 commits intotrunkfrom
stu-1284-site-thumbnail-doesnt-refresh-to-show-new-posts-after-site
Feb 9, 2026
Merged

Fix site thumbnail not refreshing after content changes#2549
sejas merged 4 commits intotrunkfrom
stu-1284-site-thumbnail-doesnt-refresh-to-show-new-posts-after-site

Conversation

@sejas
Copy link
Copy Markdown
Member

@sejas sejas commented Feb 6, 2026

Related issues

Proposed Changes

  • Regenerate the selected site thumbnail each time the user changes the theme, or focus on Studio

Testing Instructions

  • Run npm start
  • Start your site
  • See the thumbnail works as expected
  • Start a wp-admin
  • Publish a new post, or edit the site
  • Focus back to Studio App
  • Confirm the thumbnail has been updated
thumbnail.mp4

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

The thumbnail was only recaptured when the theme path changed,
so adding new posts and restarting the site would leave the
thumbnail stale. Now updateCachedThumbnail() runs on every
loadThemeDetails() call while persistThemeDetails() remains
gated on actual theme changes.
@sejas sejas self-assigned this Feb 6, 2026
@sejas sejas marked this pull request as ready for review February 9, 2026 13:40
@sejas
Copy link
Copy Markdown
Member Author

sejas commented Feb 9, 2026

I moved the thumbnail update to run every time loadThemeDetails is executed. This is the most effective way to keep the thumbnail updated and I didn't observe any performance issue. Other alternatives could include checking whether the database has been modified or loading an iframe of the site if it is running.

@sejas sejas requested a review from a team February 9, 2026 13:43
Copy link
Copy Markdown
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

Thank you for the fix, Antonio! I can confirm the issue is no longer there and the thumbnail gets refreshed correctly 🙂👍🏼 :

CleanShot.2026-02-09.at.15.07.42.mp4

The refresh happens correctly on theme change as well. 👍🏼

The only thing I noticed is that we are not using the thumbnail-loading event when the thumbnail is refreshing, but I think that's even better in this case - as I found the loading on placeholder on app focus distracting.


I also left one inline comment.

Comment thread src/tests/ipc-handlers.test.ts Outdated
} );

describe( 'loadThemeDetails', () => {
it( 'should update thumbnail even when theme has not changed', async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if we could merge this first new test with the last one.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Great suggestion. Done! 7f421b8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, Antonio! 🙂

@wpmobilebot
Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 7f421b8 vs trunk

site-editor

Metric trunk 7f421b8 Diff Change
load 2688.00 ms 2710.00 ms +22.00 ms 🔴 0.8%

site-startup

Metric trunk 7f421b8 Diff Change
siteCreation 6096.00 ms 6064.00 ms -32.00 ms 🟢 -0.5%
siteStartup 3921.00 ms 3922.00 ms +1.00 ms 🔴 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@sejas sejas merged commit 9a1c09a into trunk Feb 9, 2026
11 checks passed
@sejas sejas deleted the stu-1284-site-thumbnail-doesnt-refresh-to-show-new-posts-after-site branch February 9, 2026 15:28
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