-
Notifications
You must be signed in to change notification settings - Fork 436
fix(tanstack-react-start): Parse URL query params for TanStack Router navigation #7741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… navigation TanStack Router doesn't parse query strings from the `to` parameter, expecting them in a separate `search` option. This was causing "Not Found" errors when Clerk navigated with URLs containing query parameters (e.g., `/sign-in?redirect_url=...`). The fix parses the URL string and separates pathname, search params, and hash before passing to TanStack Router's navigate function.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: fbedee4 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 |
📝 WalkthroughWalkthroughThis pull request introduces a fix for URL navigation with query parameters in TanStack Start applications. The change adds a new utility function 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
wobsoriano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This should fix #7362 right?
|
great work, would really like to see this merged soon so our team can stop patching the clerk dependency. |
|
no, this does not fix #7362. i applied the patch manually to the dist/ output and i am noticing routerPush is called with |
Summary
TanStack Router's
navigate()function doesn't parse query strings from thetoparameter. It expects:to: pathname only (e.g.,/sign-in)search: object with query parameters (e.g.,{ redirect_url: '...' })hash: fragment string without#Previously, Clerk's
routerPushandrouterReplacewere passing the full URL string (e.g.,/sign-in?redirect_url=...) directly toto, which TanStack Router tried to match as a literal route name, causing "Not Found" errors.This affected satellite domain authentication flows and any Clerk navigation that includes query parameters.
Changes
parseUrlForNavigation()utility that extracts pathname, search params, and hash from a URL stringrouterPushandrouterReplacein ClerkProvider to use the new parsing functionTest plan
parseUrlForNavigationcovering various URL formatsSummary by CodeRabbit
Bug Fixes
/sign-in?redirect_url=...) are now properly handled and no longer cause "Not Found" errors.Tests