Skip to content

Agentic UI: Make the site settings WordPress version field a dropdown - #4284

Merged
bcotrim merged 12 commits into
trunkfrom
stu-1927-wp-version-dropdown
Jul 23, 2026
Merged

Agentic UI: Make the site settings WordPress version field a dropdown#4284
bcotrim merged 12 commits into
trunkfrom
stu-1927-wp-version-dropdown

Conversation

@bcotrim

@bcotrim bcotrim commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Implemented with Claude: reused the existing useWordPressVersions query and wpVersionField select support, then extended them for the settings form and ported the legacy version-selector semantics. Code and tests reviewed by me.

Proposed Changes

The WordPress version field in the agentic UI site settings was a free-text input, so you could type anything (including invalid versions). It's now a dropdown of the actually available WordPress versions, with the same semantics as Studio Classic:

  • "latest" (auto-update) is the first option and is preselected for auto-updating sites. Picking it saves the site as auto-updating, with no version forwarded.
  • Picking a specific version (stable, beta, or nightly) pins the site: isWpAutoUpdating: false and the version is applied on save.
  • Pinned sites show their actual installed version, read from the site's files like Classic does (new getWpVersion connector method: IPC handler on desktop, a /sites/:id/wp-version route on the local server). If the installed version is older than the fetched offers, it's inserted into the list in the right position so it stays selectable.
  • The version is only forwarded on save when the user actually changed it — matching Classic's settings modal. Previously any unrelated save of a pinned site forwarded a version and could trigger a WordPress reinstall/upgrade.
  • Offline, the field locks to "latest" — the only version we can apply without a download — and is disabled, with the explanation shown as a hover tooltip like the legacy selector. The field always stays a dropdown: when the version list can't be fetched it offers "latest" (plus the site's installed version) instead of degrading to free text.
  • The dropdown uses the same grouping as the legacy selector: Auto-updating / Beta & Nightly / Stable Versions.
Online Offline
image image

Testing Instructions

  1. Launch Studio with the agentic UI and open a site's overview → Settings tab.
  2. Check the WordPress version field is a dropdown with "latest" preselected, followed by beta/nightly and stable versions.
  3. Pick a specific version and save — the site should restart pinned to that version (auto-updates disabled).
  4. Reopen Settings: the field shows the pinned site's actual installed version.
  5. Change an unrelated field (e.g. site name) on the pinned site and save — WordPress should not be reinstalled or upgraded.
  6. Switch the version back to "latest" and save — the site should be auto-updating again.
  7. Go offline (e.g. turn off Wi-Fi): the field forces "latest", is disabled, and hovering it shows a tooltip explaining that changing the version requires an internet connection.
  8. Create-site form: confirm its WordPress version dropdown still behaves as before (no changes intended there).
  9. Verify the Settings tab in both light and dark mode.

Pre-merge Checklist

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

@bcotrim bcotrim self-assigned this Jul 21, 2026
@bcotrim
bcotrim marked this pull request as draft July 21, 2026 16:46
@wpmobilebot

wpmobilebot commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 736afc2 vs trunk

app-size

Metric trunk 736afc2 Diff Change
App Size (Mac) 1362.04 MB 1362.05 MB +0.01 MB ⚪ 0.0%

site-editor

Metric trunk 736afc2 Diff Change
load 1082 ms 1059 ms 23 ms ⚪ 0.0%

site-startup

Metric trunk 736afc2 Diff Change
siteCreation 7023 ms 7020 ms 3 ms ⚪ 0.0%
siteStartup 2353 ms 2374 ms +21 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim
bcotrim marked this pull request as ready for review July 21, 2026 20:16
…dropdown

# Conflicts:
#	apps/ui/src/data/queries/use-sites.ts
@nightnei

Copy link
Copy Markdown
Contributor

When the site is restarting, the WP version is temporarily reverted to the previous one:

1231221312.mov

@bcotrim

bcotrim commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

When the site is restarting, the WP version is temporarily reverted to the previous one:

@nightnei it should be fixed, can you take another look please? 🙇

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good. I just found a edge case that I think is misleading. When I'm offline the WP version option is disabled and it makes sense, but it also changes from the real value to latest which I think is not correct.

wp-version-offline.mp4

@bcotrim

bcotrim commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@sejas I fixed that issue, can you take another look please? 🙇

image

@bcotrim
bcotrim requested a review from sejas July 22, 2026 21:00
@nightnei

Copy link
Copy Markdown
Contributor

@bcotrim Confirm that both the bug Antonio reported and mine are fixed.
But now I faced another bug:

  1. Have latest selected as the default state
  2. Select 6.5 version and save
  3. Select latest and save - latest wasn't saved, and it's reverted to 6.5

@bcotrim

bcotrim commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@nightnei thanks for catching that, should be fixed now! 🙇

@nightnei nightnei left a comment

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 Bernardo, now works perfectly and I didn't spot any regression 👍

@bcotrim
bcotrim merged commit 0e1a4bc into trunk Jul 23, 2026
13 checks passed
@bcotrim
bcotrim deleted the stu-1927-wp-version-dropdown branch July 23, 2026 16:47
bcotrim added a commit that referenced this pull request Aug 3, 2026
#4332)

## Related issues

- Related to STU-1927
- Follow-up to #4284, which added this behavior to the site settings
form

## How AI was used in this PR

Implemented with Claude: ported the legacy `wp-version-selector` offline
semantics onto the create-site form, reusing the `offline` support
`wpVersionField` already gained in #4284. Code and tests reviewed by me.

## Proposed Changes

The WordPress version field in the agentic UI **create-site** form
didn't account for being offline. Because the version list is fetched
over the network, going offline left the field with nothing to offer and
it degraded to a free-text input — you could type any version, and only
"latest" can actually be installed without a download.

- **Offline, the field now locks to "latest"** and is disabled, with the
explanation shown as a hover tooltip — the same behavior Studio
Classic's create form has, and the same the settings form got in #4284.
- **The field stays a dropdown while offline** instead of degrading to
free text, so there's no way to type a version that can't be installed.
- **A pre-seeded version is forced back to "latest" while offline** —
e.g. when a Blueprint suggestion asks for 6.7 — so the form can't submit
something that would fail on creation.
- **Online behavior is unchanged**, including the existing free-text
fallback when the version list can't be fetched while online.

| Light | Dark |
|--------|--------|
| <img width="3248" height="2122" alt="image"
src="https://github.com/user-attachments/assets/a2ff49ab-c03a-4414-8168-e34c9975cb25"
/> | <img width="3248" height="2122" alt="image"
src="https://github.com/user-attachments/assets/d8b3a3d6-47fa-4213-95fc-d4caa4c58645"
/> |

## Testing Instructions

1. Launch Studio with the agentic UI and start creating a new site →
expand **Advanced settings**.
2. While online, confirm the WordPress version field is unchanged: a
dropdown with "latest" plus the available versions, and still editable.
3. Go offline (turn off Wi-Fi), then reopen the create-site form →
**Advanced settings**.
4. The WordPress version field should be a **disabled dropdown showing
"latest"** — not a text input. Hover it: the tooltip reads "Changing
WordPress version requires an internet connection."
5. Still offline, start the flow from a Blueprint that suggests a
specific version (e.g. 6.7) — the field should force back to "latest"
rather than keeping the suggested version.
6. Create the site while offline and confirm it succeeds on the latest
bundled version.
7. Go back online — the field should re-enable and list the fetched
versions again.
8. Check the field in **both light and dark** color schemes.

## Pre-merge Checklist

- [x] Have you checked for TypeScript, React or other console errors?
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.

4 participants