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