fix(tanstack-react-start): resolve navigation promise after location change#7526
fix(tanstack-react-start): resolve navigation promise after location change#7526Ayush2k02 wants to merge 1 commit intoclerk:mainfrom
Conversation
…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 clerk#7362
🦋 Changeset detectedLatest commit: 6e721b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@Ayush2k02 is attempting to deploy a commit to the Clerk Production Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughA patch version changeset is added for the Clerk TanStack React Start package. The Pre-merge checks✅ Passed checks (5 passed)
📜 Recent review detailsConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (10)**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
packages/**/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
packages/**/src/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.ts?(x)📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
Files:
**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Files:
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Files:
**/*⚙️ CodeRabbit configuration file
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
this does not fix #7362 |
Summary
Fixes incorrect redirects when navigating away from sign-in/sign-up pages in TanStack React Start applications.
Problem
When users navigated away from the sign-in page (e.g., clicking "go home" to navigate to
/), Clerk would issue faulty redirects to non-existent pages like/login#/?redirect_url=http%3A%2F%2Flocalhost%3A3001%2F.The root cause was in
useAwaitableNavigate: the navigation promise was being resolved immediately (res(navigate(options))) before the location actually changed. This happened because:startTransitiondefers the navigationSolution
Changed line 25 from:
to:
Now the promise is only resolved after the location actually changes (via the
useEffectthat watches the location), matching the behavior of the React Router implementation.Changes
packages/tanstack-react-start/src/client/useAwaitableNavigate.tsto remove premature promise resolutionTesting
The fix aligns the TanStack React Start implementation with the proven React Router implementation, which doesn't have this issue.
Fixes #7362
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.