-
Notifications
You must be signed in to change notification settings - Fork 8
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
Basename and dynamic basename #72
Comments
The dynamic basename should work in Rudy, although I haven't tried it myself. If you're willing to do a bit of digging to work out why it doesn't work I'd be interested to hear why. Perhaps there is a simple bug somewhere (e.g. the basename does not get passed correctly to the path matching functions)? |
Looking through the code, it looks like the option is Does that fix the problem? |
|
There is one issue though, with basename like |
You could try having the empty string as one of the basenames. Failing that, I would say that this is correct behaviour - the basename is something that is prepended to ALL routes. If you want only some routes to have it, perhaps you could make a param in each of the routes where you want it, e.g. |
Actually I want basename for all routes, including homepage, just the issue is that with |
Hmm, that makes sense. Two things to keep in mind:
It sounds to me like what you want is the ability to have the empty string as a route path, so that its possible to have a route path that does not add any segments, and also does not require a trailing slash. In the code, the exception for the root route (which cannot be the empty string) can be moved deeper so that it does not affect paths that include a basename and therefore don't require a trailing slash. I would welcome a patch to do this. There are tests in the My personal opinion: Always use trailing slashes in your URLs. If there is no trailing slash in a request, redirect to a URL that does have one. That way you don't run into these issues because the root path is not an exception to the rule. |
All my urls start with lang, like
/en
,/en/contact
etc. A perfect case forbasename
, especially dynamic one. I considered to switch from RFR to Rudy, because based on https://github.com/respond-framework/rudy/blob/master/packages/rudy/src/actions/changeBasename.js I figured that in Rudy we can change basename, so lang change would be much easier. Sadly, it doesn't work I am afraid.I have:
but
basename
does nothing, generally I migrated the whole app to Rudy and it seems to work fine, but basename is''
looking at Redux location state.If this is not supported, could you consider adding this dynamic basename feature to RFR? This is very common use case for routers, and right now I need to have
:lang
param in all urls which is very inconvenient.The text was updated successfully, but these errors were encountered: