Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stepper: Do not clear flowName in step-route tracker #97369

Merged
merged 9 commits into from
Dec 18, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import kebabCase from 'calypso/landing/stepper/utils/kebabCase';
import useSnakeCasedKeys from 'calypso/landing/stepper/utils/use-snake-cased-keys';
import { recordPageView } from 'calypso/lib/analytics/page-view';
import {
getSignupCompleteFlowNameAndClear,
getSignupCompleteFlowName,
getSignupCompleteStepNameAndClear,
} from 'calypso/signup/storageUtils';
import { useSelector } from 'calypso/state';
Expand Down Expand Up @@ -78,7 +78,7 @@ export const useStepRouteTracking = ( { flow, stepSlug, skipStepRender }: Props
return;
}

const signupCompleteFlowName = getSignupCompleteFlowNameAndClear();
const signupCompleteFlowName = getSignupCompleteFlowName();
const signupCompleteStepName = getSignupCompleteStepNameAndClear();
const isReEnteringStepAfterSignupComplete =
signupCompleteFlowName === flowName && signupCompleteStepName === stepSlug;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useIntent } from 'calypso/landing/stepper/hooks/use-intent';
import { useSelectedDesign } from 'calypso/landing/stepper/hooks/use-selected-design';
import { recordPageView } from 'calypso/lib/analytics/page-view';
import {
getSignupCompleteFlowNameAndClear,
getSignupCompleteFlowName,
getSignupCompleteStepNameAndClear,
} from 'calypso/signup/storageUtils';
import { isUserLoggedIn } from 'calypso/state/current-user/selectors';
Expand Down Expand Up @@ -171,7 +171,7 @@ describe( 'StepRoute', () => {
} );

it( 'records recordStepStart with additional props when the step is re-entered', () => {
( getSignupCompleteFlowNameAndClear as jest.Mock ).mockReturnValue( 'some-flow' );
( getSignupCompleteFlowName as jest.Mock ).mockReturnValue( 'some-flow' );
( getSignupCompleteStepNameAndClear as jest.Mock ).mockReturnValue( 'some-step-slug' );

render( { step: regularStep } );
Expand All @@ -187,7 +187,7 @@ describe( 'StepRoute', () => {
} );

it( 'records step-complete when the step is unmounted and step-start was previously recorded', () => {
( getSignupCompleteFlowNameAndClear as jest.Mock ).mockReturnValue( 'some-other-flow' );
( getSignupCompleteFlowName as jest.Mock ).mockReturnValue( 'some-other-flow' );
( getSignupCompleteStepNameAndClear as jest.Mock ).mockReturnValue( 'some-other-step-slug' );
const { unmount } = render( { step: regularStep } );

Expand All @@ -206,7 +206,7 @@ describe( 'StepRoute', () => {

it( 'records skip_step_render on start, complete and page view when the login is required and the user is not logged in', async () => {
( isUserLoggedIn as jest.Mock ).mockReturnValue( false );
( getSignupCompleteFlowNameAndClear as jest.Mock ).mockReturnValue( 'some-other-flow' );
( getSignupCompleteFlowName as jest.Mock ).mockReturnValue( 'some-other-flow' );
( getSignupCompleteStepNameAndClear as jest.Mock ).mockReturnValue( 'some-other-step-slug' );

const { unmount } = render( { step: requiresLoginStep } );
Expand Down Expand Up @@ -241,7 +241,7 @@ describe( 'StepRoute', () => {
} );

it( 'records skip_step_render on start, complete and page view when renderStep returns null', async () => {
( getSignupCompleteFlowNameAndClear as jest.Mock ).mockReturnValue( 'some-other-flow' );
( getSignupCompleteFlowName as jest.Mock ).mockReturnValue( 'some-other-flow' );
( getSignupCompleteStepNameAndClear as jest.Mock ).mockReturnValue( 'some-other-step-slug' );
const { unmount } = render( { step: regularStep, renderStep: () => null } );

Expand Down
Loading