Fix infinite redirect from homescreen to core profiler (#38768)
* Fix infinite redirect using useEffect to remove unintentional rerendering * Changelog
This commit is contained in:
parent
6b86fc64de
commit
0a50173976
|
@ -3,12 +3,14 @@
|
|||
*/
|
||||
import { compose } from '@wordpress/compose';
|
||||
import { withSelect } from '@wordpress/data';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
import {
|
||||
ONBOARDING_STORE_NAME,
|
||||
withOnboardingHydration,
|
||||
WCDataSelector,
|
||||
} from '@woocommerce/data';
|
||||
import { getHistory, getNewPath, useQuery } from '@woocommerce/navigation';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
@ -26,9 +28,15 @@ const Homescreen = ( {
|
|||
} = {},
|
||||
hasFinishedResolution,
|
||||
}: HomescreenProps ) => {
|
||||
if ( hasFinishedResolution && ! profilerCompleted && ! profilerSkipped ) {
|
||||
getHistory().push( getNewPath( {}, '/setup-wizard', {} ) );
|
||||
}
|
||||
useEffect( () => {
|
||||
if (
|
||||
hasFinishedResolution &&
|
||||
! profilerCompleted &&
|
||||
! profilerSkipped
|
||||
) {
|
||||
getHistory().push( getNewPath( {}, '/setup-wizard', {} ) );
|
||||
}
|
||||
}, [ hasFinishedResolution, profilerCompleted, profilerSkipped ] );
|
||||
|
||||
const query = useQuery();
|
||||
// @ts-expect-error Layout is a pure JS component
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix infinite redirect from homescreen when onboarding isn't completed using useEffect to remove unintentional rerendering
|
Loading…
Reference in New Issue