TanStackT
TanStack2mo ago
4 replies
developed-pink

Is there a way to validate path parameters pre-route matching?

Is there a way to validate path parameters pre-route matching?
I have multiple URLs with optional parameters like these ones: /{-$locale}/{$category}/$articleSlug
/{-$locale}/{$branch}/$slug

But in the end the route matching picks the wrong route and thinks a category is a locale. If I could add a regex validation or something to the ${-locale<(en|de|fr)>} that would be great.

Right now the only solution I can think of is to have a catch-all route & handle it case-by-case.
Was this page helpful?