Add resolution check to ensure setup-wizard redirection on homescreen is stable (https://github.com/woocommerce/woocommerce-admin/pull/8114)
* Add resolution check to ensure setup-wizard redirection is stable * Add changelogs
This commit is contained in:
parent
91fc05dcfe
commit
0c028b4a87
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: Fix
|
||||
|
||||
Ensure setup-wizard redirection on homescreen is stable. #8114
|
|
@ -18,13 +18,19 @@ import type { History } from 'history';
|
|||
import Layout from './layout';
|
||||
|
||||
type HomescreenProps = ReturnType< typeof withSelectHandler > & {
|
||||
hasFinishedResolution: boolean;
|
||||
query: Record< string, string >;
|
||||
};
|
||||
|
||||
const Homescreen = ( { profileItems, query }: HomescreenProps ) => {
|
||||
const { completed: profilerCompleted, skipped: profilerSkipped } =
|
||||
profileItems || {};
|
||||
if ( ! profilerCompleted && ! profilerSkipped ) {
|
||||
const Homescreen = ( {
|
||||
profileItems: {
|
||||
completed: profilerCompleted,
|
||||
skipped: profilerSkipped,
|
||||
} = {},
|
||||
hasFinishedResolution,
|
||||
query,
|
||||
}: HomescreenProps ) => {
|
||||
if ( hasFinishedResolution && ! profilerCompleted && ! profilerSkipped ) {
|
||||
( getHistory() as History ).push(
|
||||
getNewPath( {}, '/setup-wizard', {} )
|
||||
);
|
||||
|
@ -36,10 +42,14 @@ const Homescreen = ( { profileItems, query }: HomescreenProps ) => {
|
|||
const onboardingData = getSetting( 'onboarding', {} );
|
||||
|
||||
const withSelectHandler = ( select: WCDataSelector ) => {
|
||||
const { getProfileItems } = select( ONBOARDING_STORE_NAME );
|
||||
const profileItems = getProfileItems();
|
||||
const { getProfileItems, hasFinishedResolution } = select(
|
||||
ONBOARDING_STORE_NAME
|
||||
);
|
||||
|
||||
return { profileItems };
|
||||
return {
|
||||
profileItems: getProfileItems(),
|
||||
hasFinishedResolution: hasFinishedResolution( 'getProfileItems', [] ),
|
||||
};
|
||||
};
|
||||
|
||||
export default compose(
|
||||
|
|
Loading…
Reference in New Issue