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

href() util doesn't replace splat (*) #13166

Open
vjee opened this issue Mar 5, 2025 · 2 comments
Open

href() util doesn't replace splat (*) #13166

vjee opened this issue Mar 5, 2025 · 2 comments
Assignees

Comments

@vjee
Copy link

vjee commented Mar 5, 2025

I'm using React Router as a framework

Reproduction

href() util doesn't replace splat (*)

System Info

react-router 7.2.0

Used Package Manager

npm

Expected Behavior

href("/foo/*", { "*": "bar" }) // "/foo/bar"

Actual Behavior

href("/foo/*", { "*": "bar" }) // "/foo/*"
@vjee vjee added the bug label Mar 5, 2025
@sergiodxa
Copy link
Member

Have you tried href("/foo/*", { "*": ["bar"] })? A splat route param value is always an array (each value is a path segment)

@vjee
Copy link
Author

vjee commented Mar 5, 2025

Have you tried href("/foo/*", { "*": ["bar"] })? A splat route param value is always an array (each value is a path segment)

Thanks for the suggestion, though that doesn't work either.
The current implementation only replaces dynamic segments starting with a :.
https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/href.ts#L32

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

No branches or pull requests

3 participants