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

routing with optional parameters #119

Open
chinds185a opened this issue Jul 28, 2019 · 1 comment
Open

routing with optional parameters #119

chinds185a opened this issue Jul 28, 2019 · 1 comment

Comments

@chinds185a
Copy link

Following on from this issue #85 could you point me in the right direction where this work might need to be done?

My previous routing logic relied on react-router supporting optional params and not only splitting on a / i.e. my URL could have optional param of .amp

In react-router this works: /:language(${languageRegex})/page/:id(${idRegex}):amp(.amp)?

In navi id & amp get combined into a single param and thus never match correctly

@jamesknelson
Copy link
Collaborator

So basically the way matching works in Navi, is that the remaining part of the route is passed to a mount(), which splits it along the first / character, ignores the second half, and tries to match the first half with each of its supplied patterns.

To support more complex patterns, you'd need to modify this behavior. Here's a few relevant sections of code:

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