Skip to content

Route and index token regex not working with "+" symbol at start #7036

@RobertOstermann

Description

@RobertOstermann

Which project does this relate to?

Router

Describe the bug

The routeToken and indexToken configuration values for TanStack Router are not working as expected. Routes beginning with a "+" symbol are not working as index or layout routes.

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-o6v4qzgj?file=vite.config.js

Steps to Reproduce the Bug or Issue

  1. Setup TanStack Router with a file-based routing setup
  2. Update the routeToken and indexToken configuration values to routeToken: '+layout' and indexToken: '+page'
  3. Create an index route, +page.tsx, which should correctly have the route set.
  4. Create a folder and create and index route within that folder, folder/+page.tsx, the route is not set correctly.

Expected behavior

I expect the index and route tokens to allow setting regexes which accept values such as + at the beginning of the token. This should work for both the base index route as well as routes within folders.

Screenshots or Videos

No response

Platform

  • Router / Start Version: ^1.168.3
  • OS: macOs
  • Browser: Chrome
  • Browser Version:
  • Bundler: Vite
  • Bundler Version: 7.0.0

Additional context

No response

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