From b1c620e099fadfa73380d24f5d757da32addd2ca Mon Sep 17 00:00:00 2001 From: "whey.party" Date: Fri, 31 Jul 2026 19:49:43 +0700 Subject: [PATCH] circumvent failing to navigate away from the callback route --- src/routes/callback/index.tsx | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/routes/callback/index.tsx b/src/routes/callback/index.tsx index 5ebbeb9..85491a8 100644 --- a/src/routes/callback/index.tsx +++ b/src/routes/callback/index.tsx @@ -1,4 +1,7 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router"; +import { useEffect } from "react"; + +import { useAuth } from "~/providers/UnifiedAuthProvider"; export const Route = createFileRoute("/callback/")({ component: RouteComponent, @@ -6,8 +9,28 @@ export const Route = createFileRoute("/callback/")({ function RouteComponent() { const navigate = useNavigate(); - const redirectPath = sessionStorage.getItem("postLoginRedirect") || "/"; - navigate({ to: redirectPath }); - sessionStorage.removeItem("postLoginRedirect"); - return
Hello "/callback/"!
; + const { status } = useAuth(); + + // bug: tanstack router after commit 8ffb94077b6bee832565fa60357be6504e1809d8 + // cant handle synchronoous navigation (url change works, actual router doesnt) + useEffect(() => { + if (status === "loading") return; + + // const redirectPath = sessionStorage.getItem("postLoginRedirect"); + sessionStorage.removeItem("postLoginRedirect"); + + // hardcoded assumption that all logins go through the settings page + // related bug: useAuth status initially reports signedOut on callback route auth initialization + navigate({ to: "/settings" }); + + // not needed yet + // const [path, query] = (redirectPath ?? "/").split("?"); + // const search = query + // ? Object.fromEntries(new URLSearchParams(query)) + // : undefined; + // navigate({ to: path || "/", search }); + return + }, [status, navigate]); + + return
Signing you in...
; } -- 2.51.2