Skip to content

getRouteBaseName should accept route.name as string #3401

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

Closed
2 of 4 tasks
mrleblanc101 opened this issue Mar 12, 2025 · 1 comment · Fixed by #3446
Closed
2 of 4 tasks

getRouteBaseName should accept route.name as string #3401

mrleblanc101 opened this issue Mar 12, 2025 · 1 comment · Fixed by #3446

Comments

@mrleblanc101
Copy link
Contributor

mrleblanc101 commented Mar 12, 2025

Describe the feature

Currently, getRouteBaseName only accepts a route object and return a string or the unlocalized name.

getRouteBaseName({
    fullPath: '/fr/about',
    name: 'about___fr',
    path: '/fr/about',
    href: '/fr/about',
    ...
}) === 'index'

It would be nice it could also accept a string like so:

getRouteBaseName('about___fr') === 'index'

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@mrleblanc101
Copy link
Contributor Author

mrleblanc101 commented Mar 12, 2025

One usage exemple would be getRouteBaseName(route.name) === 'index' instead of getRouteBaseName(route) === 'index'.
I know it's more verbose, but to me it's more logical.
I accidentally always pass route.name instead of route and realize it doesn't work.

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

Successfully merging a pull request may close this issue.

2 participants