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

shouldThrow option for useParams not working #3482

Open
grishbar opened this issue Feb 19, 2025 · 1 comment
Open

shouldThrow option for useParams not working #3482

grishbar opened this issue Feb 19, 2025 · 1 comment

Comments

@grishbar
Copy link

Which project does this relate to?

Router

Describe the bug

My current route - '/'
Im trying to get page params like this:

const route = getRouteApi('/_auth/users/$userId')

export function UsersList() {
  const { userId } = route.useParams({ shouldThrow: false })
  ...
}

but im getting error - Error: Invariant failed: Could not find an active match from "/_auth/users/$userId"
Image

Also types for shouldThrow prop are wrong, it accepts only true but shoud accept any boolean value
Image

Expecting behavior, that im just get undefined in my userId value

Your Example Website or App

Steps to Reproduce the Bug or Issue

  1. go to '/' url in your project
  2. Call useParams with { shouldThrow: false } prop for another route for example '/users/$userId'
  3. get the error

Expected behavior

expected not getting arror just get undefined value

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: latest

Additional context

No response

@atev1l
Copy link

atev1l commented Feb 19, 2025

i have this problem too

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

No branches or pull requests

2 participants