diff --git a/plugins/woocommerce-admin/client/profile-wizard/steps/industry.js b/plugins/woocommerce-admin/client/profile-wizard/steps/industry.js index f869bb4e16a..2699da477b6 100644 --- a/plugins/woocommerce-admin/client/profile-wizard/steps/industry.js +++ b/plugins/woocommerce-admin/client/profile-wizard/steps/industry.js @@ -9,6 +9,7 @@ import { CardBody, CardFooter, CheckboxControl, + Spinner, } from '@wordpress/components'; import { compose } from '@wordpress/compose'; import { filter, find, findIndex, get } from 'lodash'; @@ -26,6 +27,21 @@ import { getAdminSetting } from '~/utils/admin-settings'; const onboarding = getAdminSetting( 'onboarding', {} ); +const Loader = ( props ) => { + if ( props.isLoading ) { + return ( +
+ +
+ ); + } + + return ; +}; + class Industry extends Component { constructor( props ) { const profileItems = get( props, 'profileItems', {} ); @@ -287,9 +303,16 @@ class Industry extends Component { export default compose( withSelect( ( select ) => { - const { getProfileItems, getOnboardingError, isOnboardingRequesting } = - select( ONBOARDING_STORE_NAME ); - const { getSettings } = select( SETTINGS_STORE_NAME ); + const { + getProfileItems, + getOnboardingError, + isOnboardingRequesting, + hasFinishedResolution: hasOnboardingFinishedResolution, + } = select( ONBOARDING_STORE_NAME ); + const { + getSettings, + hasFinishedResolution: hasSettingsFinishedResolution, + } = select( SETTINGS_STORE_NAME ); const { general: locationSettings = {} } = getSettings( 'general' ); return { @@ -298,6 +321,9 @@ export default compose( locationSettings, isProfileItemsRequesting: isOnboardingRequesting( 'updateProfileItems' ), + isLoading: + ! hasOnboardingFinishedResolution( 'getProfileItems', [] ) || + ! hasSettingsFinishedResolution( 'getSettings', [ 'general' ] ), }; } ), withDispatch( ( dispatch ) => { @@ -309,4 +335,4 @@ export default compose( updateProfileItems, }; } ) -)( Industry ); +)( Loader ); diff --git a/plugins/woocommerce/changelog/fix-34765-industry-reloading-page b/plugins/woocommerce/changelog/fix-34765-industry-reloading-page new file mode 100644 index 00000000000..4880cc987e4 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-34765-industry-reloading-page @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix "Industry" options fails to save in the Industry step after reloading the page for OBW