[Website] Keep the current WordPress version in the settings dropdown - #4051
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a dedicated options builder so the WordPress version <select> keeps showing the user’s selected version during the window where the runtime “supported versions” index may lag after a reboot.
Changes:
- Extracted WordPress version option construction into
getWordPressVersionOptions(...). - Ensured non-listed selected versions can be injected into the options to keep the
<select>stable. - Added focused Vitest coverage for missing-current-version handling and duplicate prevention.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/playground/website/src/components/site-manager/site-settings-form/wordpress-version-options.ts | New shared builder for WordPress version dropdown options, including “keep selected version visible” behavior. |
| packages/playground/website/src/components/site-manager/site-settings-form/wordpress-version-options.spec.ts | New tests validating the options builder behavior for missing versions and duplicates. |
| packages/playground/website/src/components/site-manager/site-settings-form/unconnected-site-settings-form.tsx | Switches the settings form to use the new options builder instead of inlined option construction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR keeps the current WordPress version visible in the settings dropdown while the version list reloads.
The list of WordPress versions comes from the running Playground. After changing settings and restarting it, that list can arrive after the form. The form then has a selected version that is not in the dropdown, so the dropdown shows its empty option.
Add the selected version to the options until the list catches up. If it is an older version and the older list is hidden, keep it in the visible list. Do not add a second copy when the version is already present.
This keeps the settings form correct when it moves into the Dock in #3965.
Verified with
npm exec nx test playground-website --output-style=staticandnpm exec nx typecheck playground-website --output-style=static.