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

location="history" and starting from child route #110

Closed
jstayton opened this issue Jul 23, 2014 · 8 comments
Closed

location="history" and starting from child route #110

jstayton opened this issue Jul 23, 2014 · 8 comments

Comments

@jstayton
Copy link

Hey guys,

When I have location="history" set on my root route, everything works as expected if I start by loading the root path. I can click <Link /> elements and other routes render without issue.

But if I start by loading a child path like /users, the handler for that route never fires. Only the root route handler (App) is rendered. There are no console warnings/errors either.

This doesn't appear to be an issue with the default, hash.

@ryanflorence
Copy link
Member

Something is probably wrong with your app or server. http://github.com/rpflorence/react-boilerplate uses history location and works just fine. Maybe try your app in that boilerplate code and see?

@ryanflorence
Copy link
Member

closing, please reopen if you are still having problems :)

@jstayton
Copy link
Author

Sorry for the delay in responding. I figured out what's happening...

Here's my route: <Route name="accounts" path="/accounts" handler={Accounts} />

Notice the path is /accounts. When I refresh that route manually in Chrome, it changes the path to /accounts/, so the route no longer matches.

If I change the route path to /accounts/, it works.

Not sure if that's intended or not, but it did trip me up. My vote would be to optionally match the trailing slash.

@jstayton
Copy link
Author

It's also an issue if no path is specified: <Route name="accounts" handler={Accounts} />

@mjackson
Copy link
Member

When I refresh that route manually in Chrome, it changes the path to /accounts/

@jstayton It sounds like your server might be setup to redirect /accounts => /accounts/. Any chance that's happening?

@ryanflorence
Copy link
Member

Since servers do not match this by default neither do we.

Here's another case for regex paths.

Sent from my iPhone

On Jul 29, 2014, at 10:28 AM, Justin Stayton notifications@github.com wrote:

Sorry for the delay in responding. I figured out what's happening...

Here's my route:

Notice the path is /accounts. When I refresh that route manually in Chrome, it changes the path to /accounts/, so the route no longer matches.

If I change the route path to /accounts/, it works.

Not sure if that's intended or not, but it did trip me up. My vote would be to optionally match the trailing slash.


Reply to this email directly or view it on GitHub.

@jstayton
Copy link
Author

Yep, you're right, that's what's happening.

I think it would great if you could do something like <Routes strict="false"> to match an optional trailing slash, similar to Express' strict routing setting. For those not concerned about being strict on the trailing slash.

@ryanflorence
Copy link
Member

#142

@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

3 participants