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

dynamic routes that match static routes #2

Closed
ryanflorence opened this issue May 24, 2014 · 2 comments
Closed

dynamic routes that match static routes #2

ryanflorence opened this issue May 24, 2014 · 2 comments

Comments

@ryanflorence
Copy link
Member

<Route name="contact" path="/contact/:id" handler={Contact}/>
<Route name="new"     path="/contact/new" handler={NewContact}/>

In this scenario transitioning to "new" will incorrectly match "contact" first and render. Reverse them and it'll work as expected like below:

<Route name="new"     path="/contact/new" handler={NewContact}/>
<Route name="contact" path="/contact/:id" handler={Contact}/>
@mjackson
Copy link
Member

As we discussed on IM, I'd say this is a bug in the JSX. We traverse the routes tree depth-first when looking for a route that matches. This makes it easy for people to follow when they're debugging stuff.

Ideally we could have some sort of "unreachable route" warning in this scenario to stop people from shooting themselves in the foot, but I'd be ok closing this for now.

@mjackson
Copy link
Member

mjackson commented Jun 9, 2014

Closing this for now since we've got a few specs going..

@mjackson mjackson closed this as completed Jun 9, 2014
gaearon pushed a commit that referenced this issue Mar 24, 2015
agundermann added a commit that referenced this issue May 9, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jan 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants