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

Potential bug with route matching #568

Open
Yamaha32088 opened this issue Nov 27, 2023 · 1 comment
Open

Potential bug with route matching #568

Yamaha32088 opened this issue Nov 27, 2023 · 1 comment

Comments

@Yamaha32088
Copy link

I am wondering if I have found a bug or if what I have found is the intended behavior. The bug I believe is the line below

const reactRouterMatch = matchPath(req.url, match as RouteProps);

It passes in req.url instead of pathname like it does in this file

const match = matchPath(pathname, { ...route, path: route.path || '*' });

The problem is that req.url can contain a query string for example https://example.com/?testing=123 which would make req.url equal to /?testing=123 and it would never actually match a route. I discovered this after trying to figure out why the match property was null inside of the Document getInitialProps function. Can someone tell me if this is the intended behavior for some reason?

@Yamaha32088 Yamaha32088 changed the title Potential bug with match property Potential bug with route matching Nov 27, 2023
@Yamaha32088
Copy link
Author

I also believe it is duplicate work because the match object returned from the call to loadInitialProps should return the same thing.

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