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:
Paul Dechov 2020-03-27 11:57:25 -04:00 committed by GitHub
parent d237256aa9
commit 0e5cfb23c0
1 changed files with 11 additions and 6 deletions

View File

@ -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' ) );