Skip to content

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

Description

@paul-sachs

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions