From 6e721b0e6e18f312f6fa81b41a5641e4be125121 Mon Sep 17 00:00:00 2001 From: Ayush Amawate Date: Fri, 26 Dec 2025 10:54:42 +0530 Subject: [PATCH] fix(tanstack-react-start): resolve navigation promise after location change Fixes incorrect redirects when navigating away from sign-in/sign-up pages. Previously, the navigation promise was resolved immediately before the location actually changed, causing Clerk to think navigation failed and issue faulty redirects to non-existent pages. Now the promise is only resolved after the location changes, matching the behavior of the React Router implementation. Fixes #7362 --- .changeset/fix-tanstack-redirect-navigation.md | 5 +++++ .../tanstack-react-start/src/client/useAwaitableNavigate.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-tanstack-redirect-navigation.md diff --git a/.changeset/fix-tanstack-redirect-navigation.md b/.changeset/fix-tanstack-redirect-navigation.md new file mode 100644 index 00000000000..2dc07acba9c --- /dev/null +++ b/.changeset/fix-tanstack-redirect-navigation.md @@ -0,0 +1,5 @@ +--- +"@clerk/tanstack-react-start": patch +--- + +Fix incorrect redirects when navigating away from sign-in/sign-up pages. The navigation promise is now resolved only after the location actually changes, preventing Clerk from issuing faulty redirects to non-existent pages. \ No newline at end of file diff --git a/packages/tanstack-react-start/src/client/useAwaitableNavigate.ts b/packages/tanstack-react-start/src/client/useAwaitableNavigate.ts index 22ed640da43..b80395725d7 100644 --- a/packages/tanstack-react-start/src/client/useAwaitableNavigate.ts +++ b/packages/tanstack-react-start/src/client/useAwaitableNavigate.ts @@ -22,7 +22,7 @@ export const useAwaitableNavigate = () => { return new Promise(res => { startTransition(() => { resolveFunctionsRef.current.push(res); - res(navigate(options)); + navigate(options); }); }); };