We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inspection of the network tab reveals that the auth check happens twice when the app loads.
This check should happen only once.
It happens twice.
The text was updated successfully, but these errors were encountered:
This actually happens 5 times for me for successful logins:
Sometimes they return at different rates and result in the UI being logged in but the API requests not being authorized.
Sorry, something went wrong.
Toyed with this during the Q&A at showcase today. This seems to work for me:
diff --git a/src/app/src/components/AuthenticationGuard.js b/src/app/src/components/AuthenticationGuard.js index 20371a2..d97431f 100644 --- a/src/app/src/components/AuthenticationGuard.js +++ b/src/app/src/components/AuthenticationGuard.js @@ -11,7 +11,7 @@ export default function AuthenticationGuard({ children }) { const dispatch = useDispatch(); const location = useLocation(); const user = useSelector(state => state.auth.user); - const [authChecked, setAuthChecked] = useState(false); + const [authChecked, setAuthChecked] = useState(!!user); useEffect(() => { if (!authChecked) {
No branches or pull requests
Overview
Inspection of the network tab reveals that the auth check happens twice when the app loads.
Expected Behavior
This check should happen only once.
Actual Behavior
It happens twice.
Steps to Reproduce
Demo
The text was updated successfully, but these errors were encountered: