From 72c69c3589712cb7d35c9573892a43a45d51e749 Mon Sep 17 00:00:00 2001 From: Robert Sreberski Date: Wed, 28 Aug 2024 18:25:39 +0200 Subject: [PATCH] Don't consider user lifecycle status when repeating evaluation (#39069) * Don't consider user lifecycle status when repeating evaluation * changelog * Improve conditions to assume user is in treatment group when having recommendations --- .../_inc/components/welcome-flow/index.tsx | 21 +++++++++++++++---- .../changelog/fix-welcome-flow-redo | 4 ++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 projects/packages/my-jetpack/changelog/fix-welcome-flow-redo diff --git a/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx b/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx index 94719828bcb2e..deb312653e88f 100644 --- a/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx +++ b/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx @@ -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, @@ -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 ) { diff --git a/projects/packages/my-jetpack/changelog/fix-welcome-flow-redo b/projects/packages/my-jetpack/changelog/fix-welcome-flow-redo new file mode 100644 index 0000000000000..82e0ddf5687a7 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/fix-welcome-flow-redo @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Don't consider user lifecycle status when repeating evaluation