TanStackT
TanStack6mo ago
2 replies
ill-bronze

session is always called on hover

i have my __root.tsx with
beforeLoad: async ({ context }) => {
    const session = await context.queryClient.fetchQuery(authQuery.session);
    return {
      session: session.data?.session,
      user: session.data?.user,
      isAuthenticated: !!session.data?.user,
    };
  },


it always get called on hover of links and when clicked. it leads to two calls every time. one for the session and one for loader of the route.

how can i fix this? i dont need the session called always but i like that its passed down to all my routes
Was this page helpful?