Karolus
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
any ideas?
11 replies
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
CC: @Tom
11 replies
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
11 replies
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
I also checked with react router, and it shares the same issue
Outlet with
<AppSidebar />
gets unmounted every time I do page navigation.11 replies
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
I created my own provider:
and use beforeLoad:
and it still share the same issue
11 replies
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
I need to say it's Tanstack Router issue, or skill issue 😄
11 replies
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
I think I am doing something wrong, because it does the same thing without convex (tried with supabase)
11 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
88 replies
CCConvex Community
•Created by Karolus on 2/1/2025 in #support-community
App Remounts on Navigation with Tanstack Router + Convex Auth
Like I mentioned above, same issue with Contex Auth Provider:
_authed.tsx
app.tsx
11 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
but Provider is different so maybe re-mounting won't happen
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
hm I will try, but are you sure? Clerk integration also relies on the same logic.: https://docs.convex.dev/auth/clerk#logged-in-and-logged-out-views
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
Yeah, got it. Just pointing that the same problem will existing no matter if it's Convex Auth or Clerk + Convex. It's a pity, I really enjoyed setting up the Auth with Convex. Super simple, good docs, but because of that issue, I don't think it's usable at this moment, at least not in Tanstack Router.
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
Tomorrow, I will switch to Clerk for auth and verify if beforeLoad fixes the issue.
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
I see, unfortunately, it causes anything that was already mounted to disappear for 1-2 seconds, like AppSidebar in my example
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
Yeah, seems like useConvexAuth() is at the component level, so it runs again for every navigation. I could probably store the auth state locally in Zustand and rely on it, but it's a bit of a stretch.
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
@Tom Actually, it happens on every navigation as well. I tested both
<Authenticated>
and useContextAuth
; they both result in this 1s delay to determine the auth state.
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
Great @Tom ,thanks for the help again. I am looking forward to the improvements 🙂
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
The only thing I am noticing in this solution:
Loading authentication... is visible after every page refresh. So there is always this 1s delay before authentication state is determined.
88 replies
CCConvex Community
•Created by Llabe on 1/23/2025 in #support-community
convex auth user creation
I see, so we would still need to wrap
Actually TanStack Router is client side router so beforeLoad also runs on client side from my understanding, so I think this approach could also work with Taurii technically.
<Outlet />
with <Authenticated />
to refresh the auth token?Actually TanStack Router is client side router so beforeLoad also runs on client side from my understanding, so I think this approach could also work with Taurii technically.
88 replies