@@ -153,7 +153,6 @@ export const VerificationCodeStep: React.FC<VerificationCodeProps> = ({
153153
154154 // Poll until user is found or max attempts reached
155155 let urlToOpen = '' ;
156- let userFound = false ;
157156 let userReady = false ;
158157 for ( let i = 0 ; i < maxAttempts ; i ++ ) {
159158 setRefetchingUserData ( true ) ;
@@ -162,29 +161,34 @@ export const VerificationCodeStep: React.FC<VerificationCodeProps> = ({
162161 // Fetch the latest user data and check if user is found
163162 const userData = await refetchUserData ( ) ;
164163 if ( userData ) {
165- userFound = true ;
166164 const userStatus = signupDataToStatus ( userData ) ;
167165 userReady = userStatus === 'ready' ;
166+
167+ const verificationRequired = userStatus === 'verify' ;
168+ // if verification is required we can stop fetching the data
169+ if ( verificationRequired ) {
170+ break ;
171+ }
172+
168173 // if user is ready we can stop fetching the data
169174 if ( userReady ) {
175+ // if namespace is not defined we can continue fetching the data
176+ if ( ! userData ?. defaultUserNamespace ) {
177+ // eslint-disable-next-line
178+ console . error (
179+ 'user is ready but default namespace is not defined yet...' ,
180+ ) ;
181+ continue ;
182+ }
170183 const productURLs = productsURLMapping ( userData ) ;
171184 // find the link to open if any
172185 urlToOpen = productURLs . find ( pu => pu . id === id ) ?. url || '' ;
173186 // User has signed up and the trial is ready and user selects the AAP Trial
174- if ( userFound && userReady ) {
175- if ( pdt === Product . AAP ) {
176- if ( ! userData ?. defaultUserNamespace ) {
177- // eslint-disable-next-line
178- console . error (
179- 'unable to provision AAP. user namespace is not defined.' ,
180- ) ;
181- return ;
182- }
183- handleAAPInstance ( userData . defaultUserNamespace ) ;
184- setAnsibleCredsModalOpen ( true ) ;
185- } else if ( urlToOpen ) {
186- window . open ( urlToOpen , '_blank' ) ;
187- }
187+ if ( pdt === Product . AAP ) {
188+ handleAAPInstance ( userData . defaultUserNamespace as string ) ;
189+ setAnsibleCredsModalOpen ( true ) ;
190+ } else if ( urlToOpen ) {
191+ window . open ( urlToOpen , '_blank' ) ;
188192 }
189193 break ;
190194 }
@@ -268,6 +272,7 @@ export const VerificationCodeStep: React.FC<VerificationCodeProps> = ({
268272
269273 < Typography
270274 data-testid = "resend-code-link"
275+ component = "div"
271276 variant = "body2"
272277 color = "primary"
273278 sx = { {
0 commit comments