TanStackT
TanStack7mo ago
1 reply
popular-magenta

Encoded URL params cause redirect loop on page refresh

Is this suppose to happen?

When using encoded parameters in routes, client-side navigation works fine, but hard refresh/page reload causes ERR_TOO_MANY_REDIRECTS.

Reproduction steps:
1. Use start-basic https://github.com/tanstack/router/tree/main/examples/react/start-basic example app
2. In post.tsx, change params for postId from post.id to post.title
3. Uncomment fetchPost({ data: postId }) and return {} so you do not get post not found error.
4. Navigate to a post with spaces in title
5. ✅ Client navigation works - URL shows encoded params, console shows decoded
6. ❌ Hard refresh the page → infinite redirect loop

Expected: Page should load normally on refresh, just like client navigation
Actual: ERR_TOO_MANY_REDIRECTS error

Anyone else seeing this? Is there a workaround for encoded params during SSR?

Created an issue of GitHub
https://github.com/TanStack/router/issues/4514
Was this page helpful?