From 0e5cfb23c0e161905e849f97d4b1af8ff868e701 Mon Sep 17 00:00:00 2001 From: Paul Dechov Date: Fri, 27 Mar 2020 11:57:25 -0400 Subject: [PATCH] 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. --- .../profile-wizard/steps/business-details.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/plugins/woocommerce-admin/client/dashboard/profile-wizard/steps/business-details.js b/plugins/woocommerce-admin/client/dashboard/profile-wizard/steps/business-details.js index 5080d111b2b..55d77af507a 100644 --- a/plugins/woocommerce-admin/client/dashboard/profile-wizard/steps/business-details.js +++ b/plugins/woocommerce-admin/client/dashboard/profile-wizard/steps/business-details.js @@ -168,7 +168,10 @@ class BusinessDetails extends Component { } else if ( name === 'other_platform_name' ) { if ( ! values.other_platform_name && - values.other_platform === 'other' + values.other_platform === 'other' && + [ 'other', 'brick-mortar-other' ].includes( + values.selling_venues + ) ) { errors.other_platform_name = __( 'This field is required', @@ -685,7 +688,7 @@ class BusinessDetails extends Component { } export default compose( - withWCApiSelect( select => { + withWCApiSelect( ( select ) => { const { getProfileItems, getProfileItemsError } = select( 'wc-api' ); return { @@ -693,10 +696,12 @@ export default compose( profileItems: getProfileItems(), }; } ), - withSelect( select => { - const { getSettings, getSettingsError, isGetSettingsRequesting } = select( - SETTINGS_STORE_NAME - ); + withSelect( ( select ) => { + const { + getSettings, + getSettingsError, + isGetSettingsRequesting, + } = select( SETTINGS_STORE_NAME ); const { general: settings = {} } = getSettings( 'general' ); const isSettingsError = Boolean( getSettingsError( 'general' ) );