Skip to content

Fix regression where themeDetails are not persisted to appdata file#2447

Merged
fredrikekelund merged 3 commits intotrunkfrom
stu-1236-theme-details-not-persisted
Jan 22, 2026
Merged

Fix regression where themeDetails are not persisted to appdata file#2447
fredrikekelund merged 3 commits intotrunkfrom
stu-1236-theme-details-not-persisted

Conversation

@fredrikekelund
Copy link
Contributor

@fredrikekelund fredrikekelund commented Jan 22, 2026

Related issues

Proposed Changes

We recently introduced a regression where SiteDetails.themeDetails objects stopped being persisted to the appdata file. This caused two problems:

  1. After restarting Studio, the Overview tab was missing the appropriate navigation buttons for stopped sites with block themes (Site Editor, etc). This happened because themeDetails object contained all empty values.
  2. The Overview tab always showed a loading state when focusing the app window. This happened because the SiteDetails.themeDetails object wasn't updated properly. Fix constant theme details refresh issue #2420 alleviated this problem, but it kept appearing due to the underlying regression.

This PR fixes the problem by:

  1. Consolidating the logic for updating themeDetails in a single function in src/ipc-handlers.ts. Previously, there were multiple execution paths to achieve this, which I believe explains why this regression surfaced in the first place.
  2. Clean up the last remaining updateSite calls in src/ipc-handlers.ts that were using this function for an ambiguous purpose (maybe update the settings, but also update the appdata file).
  3. Add a SiteDetails.persistThemeDetails method that does what you'd expect (update the themeDetails object of the site in the appdata file).
  4. Clarifying when the different IPC events are emitted, renaming them for clarity, and adding a thumbnail-load-error to reset the loading state if there's an error when loading the thumbnail.

Testing Instructions

  1. Run npm start
  2. Start a site
  3. Open the appdata file (~/Library/Application\ Support/Studio/appdata-v1.json) and ensure that the site you just started has a themeDetails object that contains the values you'd expect
  4. Focus the Studio window again
  5. Ensure that there's no "loading state" flash in the Overview tab
  6. Open wp-admin
  7. Switch the theme
  8. Focus the Studio window again
  9. Ensure that the site thumbnail in the Overview tab reloads after a few seconds

Pre-merge Checklist

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

@fredrikekelund fredrikekelund requested a review from a team January 22, 2026 10:07
@fredrikekelund fredrikekelund self-assigned this Jan 22, 2026
@wpmobilebot
Copy link
Collaborator

📊 Performance Test Results

Comparing db33316 vs trunk

site-editor

Metric trunk db33316 Diff Change
load 2863.00 ms 2892.00 ms +29.00 ms 🔴 1.0%

site-startup

Metric trunk db33316 Diff Change
siteCreation 8082.00 ms 7072.00 ms -1010.00 ms 🟢 -12.5%
siteStartup 3943.00 ms 3948.00 ms +5.00 ms 🔴 0.1%

Results are median values from multiple test runs.

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

Comment on lines +282 to 284
// Update a site's details (name, custom domain, PHP version, etc). This function calls the
// `site set` CLI command and updates the `SiteServer` instance after the CLI completes.
export async function updateSite(
Copy link
Contributor Author

@fredrikekelund fredrikekelund Jan 22, 2026

Choose a reason for hiding this comment

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

This function was previously used ambiguously (see #2360 (comment) and PR description). I've removed the last place where it was being used to update the appdata file (which it no longer did, anyway). I added this comment to prevent future confusion.

Copy link
Contributor

@bcotrim bcotrim left a comment

Choose a reason for hiding this comment

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

LGTM 👍
The workflow is clearer and I didn't find any regressions

@fredrikekelund fredrikekelund merged commit 0bc1610 into trunk Jan 22, 2026
11 checks passed
@fredrikekelund fredrikekelund deleted the stu-1236-theme-details-not-persisted branch January 22, 2026 11:12
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