You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the user is logged in, and refreshes the page (F5), it's briefly sent to the login page (/).
1. Things we've tried already (and their caveats):
Tweaking the conditions in routes/_auth.tsx and routes/index.tsx to let the user through and avoid the login flash. Because we let them through the authenticated part of the app, and the loginStatus isn't success, a request (GET /user-profile) is fired w/o Authentication header, causing a 401, and triggering the token refresh again, this time through the Axios interceptor.
Transient route /loading outside of _auth. This briefly "flashes" an error when refreshing the page. Not 100% sure why tbf, but it could be because we're going out and in _auth routes. Check video.
2025-08-28.00-10-33.mp4
2. Some random ideas/gut feelings that might or might not work:
Decouple loginStatus from isLoading/isReloading. ATM they're all derived from loginStatus, and mutually exclusive. ie: cannot be success | unauthorized AND loading | reloading.
Let the user through (assuming they're auth'd) if they have a refresh token in their localstorage. In first instance, this could feel the same than the interceptor refresh logic, but the main differences are:
When the interceptor does the token refresh, there's already data in the screen. On a refresh (F5), we can't display any data simply because we don't have it. We could show "skeletons" though.
We'll probably hit a 401 in GET /user-profile if we let the user through as authenticated, like in 1.1.
When the user is logged in, and refreshes the page (F5), it's briefly sent to the login page (
/).1. Things we've tried already (and their caveats):
Tweaking the conditions in
routes/_auth.tsxandroutes/index.tsxto let the user through and avoid the login flash. Because we let them through the authenticated part of the app, and theloginStatusisn'tsuccess, a request (GET /user-profile) is fired w/o Authentication header, causing a 401, and triggering the token refresh again, this time through the Axios interceptor.Transient route
/loadingoutside of_auth. This briefly "flashes" an error when refreshing the page. Not 100% sure why tbf, but it could be because we're going out and in_authroutes. Check video.2025-08-28.00-10-33.mp4
2. Some random ideas/gut feelings that might or might not work:
Decouple
loginStatusfromisLoading/isReloading. ATM they're all derived fromloginStatus, and mutually exclusive. ie: cannot besuccess | unauthorizedANDloading | reloading.Let the user through (assuming they're auth'd) if they have a refresh token in their localstorage. In first instance, this could feel the same than the interceptor refresh logic, but the main differences are:
GET /user-profileif we let the user through as authenticated, like in1.1.