Skip to content
Source
Sign inSign up
TanStack/router

Trailing slash options isn't enforced with splat route #5385

Send to my agent
Closedpaul-sachs(GitHub profile, opens in a new tab) opened this issue 1 comment

Which project does this relate to?

Router

Describe the bug

When you have a route defined with a splat such as some-testing.route.$.tsx and have a link like so:

<Link to="/some-testing/route/$" params={{ _splat: "" }} />

The generated path is always /some-testing/route/ regardless of trailingSlash option. If we try to instead of {{ _splat: undefined }} the route is /some-testing/route/undefined which is also incorrect.

Your Example Website or App

https://stackblitz.com/edit/github-oehqi8ag-yf2ynpjd?file=src%2Froutes%2F__root.tsx

Steps to Reproduce the Bug or Issue

  1. Open stackblitz
  2. Hover over Trailing Slash link and notice the href ends in slash

Expected behavior

Because the default trailingSlash option is set to never, it should always remove the trailing slash. Also, an undefined _splat should probably not render as undefined.

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.132.33
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 140.0.7339
  • Bundler: Vite
  • Bundler Version: 7.1.17

Additional context

No response

  1. I can submit a PR to fix this but i just want to make sure this is indeed unexpected behaviour.

Sign in to join this conversation.