T
TanStack5mo ago
flat-fuchsia

beforeLoad or loader for authentication redirection

Hey everyone, have a pretty simple issue. I am building a react app, and am using the router's authenticated routes + supabase for authentication. I've included a screenshot of my auth.tsx file, and my AuthContext provider. When I navigate between routes, everything works fine. I can only go to protected routes when signed in. However, if I am signed in, and on a protected route, and then I fully reload the page, it brings me back to the login screen. It seems like the beforeLoad function doesn't have the values of the context provider in time on full-reload. However, if I switch the function in __auth.tsx to loader, it works every time, context.auth.isAuthenticated is true. Anybody know why this would be?
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?