Skip to content

Commit 2a7757f

Browse files
authored
Update @wordpress/components and @wordpress/dataviews packages to the latest versions as of 22nd of October 2025 (#106646)
* Update @wordpress/components and @wordpress/dataviews to 30.6.0 and 10.1.0 * Move away from isItemValid to useFormValidity * Fix the form validation to use validity and also fixed a failing test * Remove isDestructive action property * Fix how we handle async validators for the phone field * Remove dependency on wordpress/components/src/utils/theme-variables * Change the action labels for domains and remove the obsolete icons * Set isPrimary to false for actions while in list view for Sites
1 parent b96aad9 commit 2a7757f

File tree

44 files changed

+157
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+157
-142
lines changed

apps/design-system-docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"@mdx-js/react": "^3.1.0",
2929
"@wordpress/base-styles": "^5.23.0",
3030
"@wordpress/browserslist-config": "^6.23.0",
31-
"@wordpress/components": "^30.4.0",
32-
"@wordpress/dataviews": "^9.0.0",
31+
"@wordpress/components": "30.6.0",
32+
"@wordpress/dataviews": "10.1.0",
3333
"docusaurus-plugin-sass": "^0.2.6",
3434
"prism-react-renderer": "^2.4.1",
3535
"react": "^18.3.1",

apps/happy-blocks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@wordpress/base-styles": "^5.23.0",
3838
"@wordpress/block-editor": "^14.18.0",
3939
"@wordpress/blocks": "^14.12.0",
40-
"@wordpress/components": "^30.4.0",
40+
"@wordpress/components": "30.6.0",
4141
"@wordpress/data": "^10.23.0",
4242
"@wordpress/element": "^6.23.0",
4343
"@wordpress/i18n": "^5.23.0",

apps/help-center/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@automattic/i18n-utils": "workspace:^",
3838
"@automattic/zendesk-client": "workspace:^",
3939
"@tanstack/react-query": "^5.83.0",
40-
"@wordpress/components": "^30.4.0",
40+
"@wordpress/components": "30.6.0",
4141
"@wordpress/compose": "^7.23.0",
4242
"@wordpress/data": "^10.23.0",
4343
"@wordpress/dom-ready": "^4.29.0",

apps/notifications/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"@automattic/components": "workspace:^",
3131
"@automattic/i18n-utils": "workspace:^",
3232
"@automattic/webpack-extensive-lodash-replacement-plugin": "workspace:^",
33-
"@wordpress/components": "^30.4.0",
33+
"@wordpress/components": "30.6.0",
3434
"@wordpress/data": "^10.23.0",
35-
"@wordpress/dataviews": "^9.0.0",
35+
"@wordpress/dataviews": "10.1.0",
3636
"@wordpress/element": "^6.23.0",
3737
"@wordpress/i18n": "^5.23.0",
3838
"@wordpress/icons": "^10.23.0",

apps/o2-blocks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@wordpress/base-styles": "^5.23.0",
2828
"@wordpress/block-editor": "^14.18.0",
2929
"@wordpress/blocks": "^14.12.0",
30-
"@wordpress/components": "^30.4.0",
30+
"@wordpress/components": "30.6.0",
3131
"@wordpress/data": "^10.23.0",
3232
"@wordpress/editor": "^14.23.0",
3333
"@wordpress/element": "^6.23.0",

apps/wpcom-block-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@wordpress/base-styles": "^5.23.0",
3030
"@wordpress/block-editor": "^14.18.0",
3131
"@wordpress/blocks": "^14.12.0",
32-
"@wordpress/components": "^30.4.0",
32+
"@wordpress/components": "30.6.0",
3333
"@wordpress/compose": "^7.23.0",
3434
"@wordpress/data": "^10.23.0",
3535
"@wordpress/dom-ready": "^4.23.0",

client/dashboard/domains/dataviews/actions.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import { userPurchasesQuery, siteSetPrimaryDomainMutation } from '@automattic/ap
33
import { isFreeUrlDomainName } from '@automattic/domains-table/src/utils/is-free-url-domain-name';
44
import { useQuery, useMutation } from '@tanstack/react-query';
55
import { useRouter } from '@tanstack/react-router';
6-
import { Icon } from '@wordpress/components';
76
import { useDispatch } from '@wordpress/data';
87
import { sprintf, __ } from '@wordpress/i18n';
9-
import { payment, tool } from '@wordpress/icons';
108
import { store as noticesStore } from '@wordpress/notices';
119
import { useMemo, Suspense, lazy } from 'react';
1210
import {
@@ -53,8 +51,7 @@ export const useActions = ( { user, sites }: { user: User; sites?: Site[] } ) =>
5351
{
5452
id: 'renew',
5553
isPrimary: true,
56-
icon: <Icon icon={ payment } />,
57-
label: __( 'Renew now' ),
54+
label: __( 'Renew' ),
5855
callback: ( items: DomainSummary[] ) => {
5956
const domain = items[ 0 ];
6057
const purchase = purchases?.find(
@@ -72,8 +69,7 @@ export const useActions = ( { user, sites }: { user: User; sites?: Site[] } ) =>
7269
{
7370
id: 'setup',
7471
isPrimary: true,
75-
icon: <Icon icon={ tool } />,
76-
label: __( 'Set up connection' ),
72+
label: __( 'Set up' ),
7773
callback: ( items: DomainSummary[] ) => {
7874
const domain = items[ 0 ];
7975

client/dashboard/domains/domain-contact-details/contact-form-fields.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
__experimentalText as Text,
88
} from '@wordpress/components';
99
import { type Field } from '@wordpress/dataviews';
10-
import { createInterpolateElement } from '@wordpress/element';
10+
import { createInterpolateElement, useEffect, useState } from '@wordpress/element';
1111
import { __, sprintf } from '@wordpress/i18n';
1212
import InlineSupportLink from '../../components/inline-support-link';
1313
import PhoneNumberInput from '../../components/phone-number-input';
@@ -68,7 +68,20 @@ export const getContactFormFields = (
6868
( country ) => country.numeric_code === countryNumericCode
6969
);
7070

71-
const validationMessage = field.isValid?.custom?.( data, field );
71+
// Handle both sync and async validators
72+
const [ validationMessage, setValidationMessage ] = useState< string | null >( null );
73+
74+
useEffect( () => {
75+
const result = field.isValid?.custom?.( data, field );
76+
77+
// Check if the result is a Promise (async validator)
78+
if ( result instanceof Promise ) {
79+
result.then( setValidationMessage );
80+
} else {
81+
// Sync validator - set the result directly
82+
setValidationMessage( result ?? null );
83+
}
84+
}, [ data, field ] );
7285

7386
return (
7487
<PhoneNumberInput

client/dashboard/domains/domain-contact-details/contact-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Button,
1515
} from '@wordpress/components';
1616
import { useDispatch } from '@wordpress/data';
17-
import { DataForm, Field, isItemValid, FormField } from '@wordpress/dataviews';
17+
import { DataForm, Field, useFormValidity, FormField } from '@wordpress/dataviews';
1818
import { createInterpolateElement } from '@wordpress/element';
1919
import { __, sprintf } from '@wordpress/i18n';
2020
import { store as noticesStore } from '@wordpress/notices';
@@ -125,7 +125,7 @@ export default function ContactForm( { domainName, initialData }: ContactFormPro
125125
],
126126
};
127127

128-
const canSave = isItemValid( normalizedFormData, fields, form );
128+
const { isValid: canSave } = useFormValidity( normalizedFormData, fields, form );
129129

130130
return (
131131
<VStack spacing={ 10 }>

client/dashboard/domains/domain-dns/email-setup-form.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type DnsTemplateVariables } from '@automattic/api-core';
22
import { domainDnsApplyTemplateMutation } from '@automattic/api-queries';
33
import { useMutation } from '@tanstack/react-query';
44
import { __experimentalVStack as VStack, Button } from '@wordpress/components';
5-
import { DataForm, Field, isItemValid } from '@wordpress/dataviews';
5+
import { DataForm, Field, useFormValidity } from '@wordpress/dataviews';
66
import { __, sprintf } from '@wordpress/i18n';
77
import { useState } from 'react';
88
import { domainRoute } from '../../app/router/domains';
@@ -101,8 +101,9 @@ export default function EmailSetupForm( {
101101
},
102102
},
103103
];
104+
const { isValid } = useFormValidity( formData, fields, form );
104105

105-
const canSubmit = formData.record && isItemValid( formData, fields, form );
106+
const canSubmit = formData.record && isValid;
106107

107108
return (
108109
<div style={ { marginTop: '28px' } }>

0 commit comments

Comments
 (0)