Skip to content

Commit

Permalink
Don't consider user lifecycle status when repeating evaluation (#39069)
Browse files Browse the repository at this point in the history
* Don't consider user lifecycle status when repeating evaluation

* changelog

* Improve conditions to assume user is in treatment group when having recommendations
  • Loading branch information
robertsreberski authored and gogdzl committed Oct 25, 2024
1 parent fa23ad6 commit 72c69c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export type WelcomeFlowExperiment = {
const WelcomeFlow: FC< PropsWithChildren > = ( { children } ) => {
const { recordEvent } = useAnalytics();
const { dismissWelcomeBanner } = useWelcomeBanner();
const { submitEvaluation, saveEvaluationResult } = useEvaluationRecommendations();
const { recommendedModules, submitEvaluation, saveEvaluationResult } =
useEvaluationRecommendations();
const {
siteIsRegistered,
siteIsRegistering,
Expand All @@ -44,15 +45,27 @@ const WelcomeFlow: FC< PropsWithChildren > = ( { children } ) => {
if ( ! siteIsRegistered || welcomeFlowExperiment.isLoading ) {
return 'connection';
} else if ( ! isProcessingEvaluation ) {
if ( ! isJetpackUserNew() || welcomeFlowExperiment.variation !== 'treatment' ) {
// If the user is not new, we don't show the evaluation step
if (
! recommendedModules &&
( welcomeFlowExperiment.variation === 'control' || ! isJetpackUserNew() )
) {
// If user is not new but doesn't have recommendations, we skip evaluation
// If user has recommendations, it means they were already in treatment group and they redo the evaluation
return null;
}

// Otherwise, it means user is either new or just repeats the recommendation
return 'evaluation';
}

return 'evaluation-processing';
}, [ isProcessingEvaluation, siteIsRegistered, welcomeFlowExperiment ] );
}, [
isProcessingEvaluation,
recommendedModules,
siteIsRegistered,
welcomeFlowExperiment.isLoading,
welcomeFlowExperiment.variation,
] );

useEffect( () => {
if ( prevStep !== currentStep ) {
Expand Down
4 changes: 4 additions & 0 deletions projects/packages/my-jetpack/changelog/fix-welcome-flow-redo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Don't consider user lifecycle status when repeating evaluation

0 comments on commit 72c69c3

Please sign in to comment.