fix(tanstack-react-start): Parse URL query params for TanStack Router navigation#7741
fix(tanstack-react-start): Parse URL query params for TanStack Router navigation#7741nikosdouvlis wants to merge 1 commit intomainfrom
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.
Thanks! This should fix #7362 right?
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