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

Navigation of root paths with 'basePath' prop #249

Open
upreeti opened this issue Dec 16, 2024 · 0 comments
Open

Navigation of root paths with 'basePath' prop #249

upreeti opened this issue Dec 16, 2024 · 0 comments

Comments

@upreeti
Copy link

upreeti commented Dec 16, 2024

We have an application that uses the basePath prop to prefix all the routes. However, when we navigate to the root URL, we get a 404 error since the basePath is not prefixed (e.g., when basePath is 'base', localhost:8080/ and localhost:8080/base show a 404 since we do not end up on localhost:8080/base/).

To get around this issue, we added a patch fix with a rootPaths prop, which ignores the basePath for certain routes (/, and /base in our case), and we were wondering if we could upstream this change or if there is a better way to fix this.

Our patch fix (no basePath if rootPaths includes pathname in this line):
const matchedRoute = rootPaths.includes(pathname) ? execRouteMatching(routes[i], pathname, queryParamObject, '') : execRouteMatching(routes[i], pathname, queryParamObject, basePath);

@upreeti upreeti changed the title Navigation of root paths with 'basePath Navigation of root paths with 'basePath' prop Dec 16, 2024
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

1 participant