From 63855726a4bf5d6e7b64be6eefa61792f6a2eb0b Mon Sep 17 00:00:00 2001 From: Omar Alshaker Date: Tue, 18 Jul 2023 16:03:24 +0200 Subject: [PATCH] Domain transfer: Clear store in complete step (#79538) --- .../domain-transfer-complete/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/domain-transfer-complete/index.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/domain-transfer-complete/index.tsx index 63c0765f07f9d5..7d0b8452eb293d 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/domain-transfer-complete/index.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/domain-transfer-complete/index.tsx @@ -45,13 +45,19 @@ const Complete: Step = function Complete( { flow } ) { useEffect( () => { dispatch( fetchUserPurchases( userId ) ); - }, [] ); + }, [ dispatch, userId ] ); + + // Once user purchases are loaded, we don't need the information in the store anymore and can discard it. + useEffect( () => { + if ( userPurchases ) { + resetOnboardStore(); + } + }, [ userPurchases, resetOnboardStore ] ); const clearDomainsStore = () => { recordTracksEvent( 'calypso_domain_transfer_complete_click', { destination: '/setup/domain-transfer', } ); - resetOnboardStore(); }; return (