Improve authentication session handling to prevent pages from disappearing

Update query options for the session endpoint to set staleTime, gcTime, and disable refetchOnWindowFocus and refetchOnMount.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 279f1558-c0e3-40e4-8217-be7e9f4c6eca
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: fe51a801-9ddd-4ebd-97be-42fe1cf117c5
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/b984cb14-1d19-4944-922b-bc79e821ed35/279f1558-c0e3-40e4-8217-be7e9f4c6eca/hiQP6r9
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sirpiglr 2025-12-16 00:43:05 +00:00
parent 9c99d35836
commit c4e451da90

View file

@ -27,6 +27,10 @@ export function AuthProvider({ children }: { children: ReactNode }) {
const res = await fetch("/api/auth/session", { credentials: "include" });
return res.json();
},
staleTime: 30000,
gcTime: 60000,
refetchOnWindowFocus: false,
refetchOnMount: false,
});
const loginMutation = useMutation({