Onboarding: only validate other platform name for 'other' selling venues (https://github.com/woocommerce/woocommerce-admin/pull/4011)
Omit validation error (and resulting disabled "Continue" button) on the other platform name text field, in an edge case where the field is first required but value is missing, and then no longer required.
This commit is contained in:
parent
d237256aa9
commit
0e5cfb23c0
|
@ -168,7 +168,10 @@ class BusinessDetails extends Component {
|
||||||
} else if ( name === 'other_platform_name' ) {
|
} else if ( name === 'other_platform_name' ) {
|
||||||
if (
|
if (
|
||||||
! values.other_platform_name &&
|
! values.other_platform_name &&
|
||||||
values.other_platform === 'other'
|
values.other_platform === 'other' &&
|
||||||
|
[ 'other', 'brick-mortar-other' ].includes(
|
||||||
|
values.selling_venues
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
errors.other_platform_name = __(
|
errors.other_platform_name = __(
|
||||||
'This field is required',
|
'This field is required',
|
||||||
|
@ -685,7 +688,7 @@ class BusinessDetails extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withWCApiSelect( select => {
|
withWCApiSelect( ( select ) => {
|
||||||
const { getProfileItems, getProfileItemsError } = select( 'wc-api' );
|
const { getProfileItems, getProfileItemsError } = select( 'wc-api' );
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -693,10 +696,12 @@ export default compose(
|
||||||
profileItems: getProfileItems(),
|
profileItems: getProfileItems(),
|
||||||
};
|
};
|
||||||
} ),
|
} ),
|
||||||
withSelect( select => {
|
withSelect( ( select ) => {
|
||||||
const { getSettings, getSettingsError, isGetSettingsRequesting } = select(
|
const {
|
||||||
SETTINGS_STORE_NAME
|
getSettings,
|
||||||
);
|
getSettingsError,
|
||||||
|
isGetSettingsRequesting,
|
||||||
|
} = select( SETTINGS_STORE_NAME );
|
||||||
|
|
||||||
const { general: settings = {} } = getSettings( 'general' );
|
const { general: settings = {} } = getSettings( 'general' );
|
||||||
const isSettingsError = Boolean( getSettingsError( 'general' ) );
|
const isSettingsError = Boolean( getSettingsError( 'general' ) );
|
||||||
|
|
Loading…
Reference in New Issue