Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for static prefix on dynamic paths #707

Open
FugiTech opened this issue Aug 31, 2023 · 4 comments
Open

Support for static prefix on dynamic paths #707

FugiTech opened this issue Aug 31, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@FugiTech
Copy link
Contributor

Describe the bug

Currently TanStack Router supports dynamic path segments in the form /$var/. However it is sometimes useful to have a static prefix (or suffix) that is used as part of the matching. For example youtube.com/@ChannelName.

This is a feature request for Router to support the form /prefix$var/ (or some other way of having a static prefix mixed with a dynamic variable). Optionally it would be nice to also support suffixes, perhaps in the form /prefix$var$suffix/?

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-jwzga9?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

new Route({
  path: '/prefix$var',
  component: function User({ useParams }) {
    const params = useParams();
    return <div className="p-2">Hello {params.var}!</div>;
  },
});

This will not be recognized as a dynamic route and var will not be available in params

Expected behavior

var would be available in params

Screenshots or Videos

No response

Platform

N/A

Additional context

No response

@tannerlinsley
Copy link
Collaborator

Now that things are pretty stable, I'd like to see this PR updated.

@tannerlinsley tannerlinsley added the enhancement New feature or request label Dec 10, 2023
@FugiTech
Copy link
Contributor Author

I updated the PR to remove the merge conflicts but didn't do an in-depth look at what's changed in the last 4 months

@JacobWennebro
Copy link

Any update on this?

@schiller-manuel
Copy link
Contributor

this was closed: #709

would need to be redone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants