I have a react app with Auth0 react SDK. In my scenario, I set a returnTo in the cookie and when auth0 redirects user back to the app from the login, the app can restore back to the original application url. However I notice that when auth0 redirected back to app the isAuthenticated flag went from False, True, True.
The question is to why the useEffect runs twice for the same isAuthenticated value which is true?
Reproduction
create a useEffect and put isAuthenticated as a dependency. Trigger a login and redirect you ll see that useEffect is triggered twice for the same value.
Checklist
Description
Hi there,
I have a react app with Auth0 react SDK. In my scenario, I set a returnTo in the cookie and when auth0 redirects user back to the app from the login, the app can restore back to the original application url. However I notice that when auth0 redirected back to app the isAuthenticated flag went from False, True, True.
The question is to why the useEffect runs twice for the same isAuthenticated value which is true?
Reproduction
create a useEffect and put isAuthenticated as a dependency. Trigger a login and redirect you ll see that useEffect is triggered twice for the same value.
Additional context
No response
auth0-react version
2.2.4
React version
18.3.1
Which browsers have you tested in?
Chrome