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

Using base and hashRouter produces weird URLs #268

Closed
wldcordeiro opened this issue Aug 29, 2018 · 5 comments
Closed

Using base and hashRouter produces weird URLs #268

wldcordeiro opened this issue Aug 29, 2018 · 5 comments

Comments

@wldcordeiro
Copy link

Bug Report

When you set a different base and use the hashRouter you get weird duplication of URLs.

For example you set base to /foo and then go to your deployed doc site and click around

you'll end up with something like /foo/#/foo/<sub>/<sub>/

Expected behavior

The base isn't appended on every URL on top of itself

@Yurickh
Copy link

Yurickh commented Aug 30, 2018

As the documentation suggest, you should always start and end your base with a slash.

But I wonder if this would be a nice feature for docz. What do you think @pedronauck?

I could work on ensuring that base always have the slashes by either warning or inserting them when due.

@wldcordeiro
Copy link
Author

wldcordeiro commented Aug 30, 2018

@Yurickh the problem with that is that base is used by react-router which in its documentation says to not have an ending slash, however I saw the same problem one way or the other.

https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string

A properly formatted basename should have a leading slash, but no trailing slash.

I imagine base is also used for webpack and between the two libs there's a misconfiguration.

@wldcordeiro
Copy link
Author

@exah thanks for digging in, looks like it's what I was expecting! For me I would want to leave this routerBase as is / and the base for webpack I'd want to change for something like github/gitlab pages.

@pedronauck
Copy link
Member

For sure, thanks guy! The basename on router, in this case, is used to bind Link component, but I think that isn't necessary since webpack public path is setted, I'll remove basename from router and release in the next release 🙏

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

4 participants