Skip to content

Dashboard v2: Implement WP version settings #103560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Conversation

fushar
Copy link
Contributor

@fushar fushar commented May 20, 2025

Part of DOTCOM-13166

Proposed Changes

This PR implements the WordPress version settings in dashboard v2.

Simple and Atomic sites

Staging sites



Testing Instructions

  1. Go to /v2/sites.
  2. Select a site.
  3. Go to Settings.
  4. Verify you can see and update the WordPress version as shown in the screenshot above. Test staging and non-staging sites.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot
Copy link
Contributor

matticbot commented May 20, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug settings-wp-version on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented May 20, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~8746 bytes removed 📉 [gzipped])

name                    parsed_size           gzip_size
entry-dashboard-dotcom      +2883 B  (+0.3%)     +240 B  (+0.1%)
entry-dashboard-a4a         +2883 B  (+0.3%)     +527 B  (+0.2%)
entry-subscriptions          +318 B  (+0.0%)      +86 B  (+0.0%)
entry-stepper                +318 B  (+0.0%)      +85 B  (+0.0%)
entry-reauth-required        +318 B  (+0.0%)      +86 B  (+0.0%)
entry-main                   +318 B  (+0.0%)      +81 B  (+0.0%)
entry-login                  +318 B  (+0.0%)      +86 B  (+0.0%)
entry-domains-landing        +318 B  (+0.0%)      +86 B  (+0.0%)
entry-browsehappy            +318 B  (+0.2%)      +86 B  (+0.1%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@fushar fushar force-pushed the settings-wp-version branch 3 times, most recently from 12291bf to 114c38f Compare May 21, 2025 04:35
@fushar fushar force-pushed the settings-wp-version branch from 114c38f to 30f4fc6 Compare May 21, 2025 04:41
@fushar fushar marked this pull request as ready for review May 21, 2025 04:54
@fushar fushar requested review from youknowriad and a team as code owners May 21, 2025 04:54
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 21, 2025
@fushar fushar requested a review from matt-west May 21, 2025 04:54
@@ -86,6 +86,26 @@ export const fetchPHPVersion = async ( id: string ): Promise< string | undefined
} );
};

export const fetchWordPressVersion = async ( siteIdOrSlug: string ): Promise< string > => {
return wpcom.req.get( {
path: `/sites/${ siteIdOrSlug }/hosting/wp-version`,
Copy link
Member

Choose a reason for hiding this comment

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

I couldn't find any docs to this endpoint. Can you share if you have a link that I missed?

Does it just return latest or beta? Do we need these labels (in design spec or if we deem them useful)?

Can we get this info and the WP version from a single place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a whole project for this feature: pesfPa-qt-p2.

Yes, the endpoint just return either latest or beta. Also, this is how it looks in dashboard v1:

image

I'm really hesitant to change the endpoint (it would break v1 or whatnot) or the core design of this feature for now... porting features to v2 and changing the functionalities should be different activities.

Copy link
Member

Choose a reason for hiding this comment

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

porting features to v2 and changing the functionalities should be different activities.

Agreed, but we should track what we can improve and/or simplify. I might be missing context, but I think we should consider getting WP info from a single endpoint (probably remove this one and update the calls of v1).

Additionally, not for this PR, we might want to revisit the design for this and add some help text about the options.

@@ -0,0 +1,5 @@
import { Site } from '../../data/types';

export function canUpdateWordPressVersion( site: Site ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this not a "feature", why should we check the "type" of site?

import { __ } from '@wordpress/i18n';
import type { Site } from '../data/types';

export function getWordPressVersionTagName( versionTag: string ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this function bring any value, it feels we can just use the strings inline where it's currently used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really 100% sure either to be honest, the only difference is that it's translated 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants