From 90c6d400389ed77ccea8e83538246910f3198748 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 17 May 2024 18:52:35 +0530 Subject: [PATCH] Changes to ensure refresh doesn't bypass things --- .../components/ErrorState/Step/SiteGen/index.js | 4 +++- .../components/NewfoldInterfaceSkeleton/SiteGen/index.js | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/OnboardingSPA/components/ErrorState/Step/SiteGen/index.js b/src/OnboardingSPA/components/ErrorState/Step/SiteGen/index.js index 9d2ebccee..ef56822cd 100644 --- a/src/OnboardingSPA/components/ErrorState/Step/SiteGen/index.js +++ b/src/OnboardingSPA/components/ErrorState/Step/SiteGen/index.js @@ -27,6 +27,7 @@ import { HEADER_SITEGEN, pluginDashboardPage, } from '../../../../../constants'; +import { setFlow } from '../../../../utils/api/flow'; const SiteGenStepErrorState = () => { const navigate = useNavigate(); @@ -105,8 +106,9 @@ const SiteGenStepErrorState = () => { navigate( data.steps[ 1 ].path ); }; - const handleRetry = () => { + const handleRetry = async () => { updateSiteGenErrorStatus( false ); + await setFlow( currentData ); }; const handleGoBack = () => { diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js index e1b0f14c6..420290866 100644 --- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js +++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js @@ -261,6 +261,15 @@ const SiteGen = () => { return; } + // If retries are exhausted don't make requests + if ( + currentData.sitegen?.siteGenErrorMeta?.retryCount >= + currentData.sitegen?.siteGenErrorMeta?.maxRetryCount + ) { + updateSiteGenErrorStatus( true ); + return; + } + setIsGeneratingSiteMeta( true ); if ( ! window.nfdOnboarding?.siteGenTimerInterval ) {