Freeze + Crash when trying to setup Authenticated Routes.
problem.
I have a Vite + Router + Query + Start application and I am trying to setup authentication on it. I've followed how to setup authenticated routes guide. For some reason the application freezes on "Loading" & If I comment out loading, it immediately crashes. Even
useEffect() from my useAuth.tsx() hook doesn't execute to update the auth state whoes job was to invalidate isLoading that renders "Loading". I'm not really sure what I'm doing wrong. Please help! This is my first time using Tanstack Router.
code.
My router.tsx looks like this,
& root route contains authentication context state AuthState whcih comes from a useAuth() hook. This hook instantiates login, logout & auth state itself & returns the following,
I'm also confused about <RouterProvider /> (which I believe is what propogates authentication state from useAuth() hook to the router itself) alonsgide Start. It doesn't matter if I add or remove it. Everything stays Frozen.2 Replies
sensitive-blueOP•4w ago
The error I get if I reload (while frozen on loading)
I've trimmed stacktrace to important errors.
I've narrowed down the issue. It occurs after I add
<AuthProvider>... to the <RootComponent />. It doesn't matter if I add <RouterProvider /> inside <RootDocument>.
The application works fine if I remove <AuthProvider /> but goes into infinite loops and crashes when AuthProvider is added....flat-fuchsia•2w ago
do u happen to have a export for serverfn in the same file?
I had a similar thing where i had a server function declared in one of my routes that caused this or any exports other then the main ones in the routes dir for the page (edited)Saturday, November 15, 2025 at 3:34 PM
Send a message in "Freeze + Crash when trying to setup Authenticated Routes."