Fix industry options not populate after reloading page (#34847)
* Add a spinner loader to ensure Industry loaded after data fetched * Add changelog Fix style
This commit is contained in:
parent
84641b1c41
commit
c31f8b0aa5
|
@ -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 (
|
||||
<div
|
||||
className="woocommerce-admin__industry__spinner"
|
||||
style={ { textAlign: 'center' } }
|
||||
>
|
||||
<Spinner />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <Industry { ...props } />;
|
||||
};
|
||||
|
||||
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 );
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix "Industry" options fails to save in the Industry step after reloading the page for OBW
|
Loading…
Reference in New Issue