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

NavLink not working without pathname #5977

Closed
hellqvist opened this issue Feb 28, 2018 · 5 comments
Closed

NavLink not working without pathname #5977

hellqvist opened this issue Feb 28, 2018 · 5 comments
Labels

Comments

@hellqvist
Copy link

Version

master (commit: e6f9017)

Test Case

https://codesandbox.io/s/3x3oxk33k6

Steps to reproduce

Add a NavLink without pathname, only search in the to object.

Expected Behavior

Classname active shall be added on all paths as long as the query matches the search value.

Actual Behavior

TypeError
Cannot read property 'replace' of undefined

Before escaping characters in path we need to verify that it's not null or undefined.

@timdorr
Copy link
Member

timdorr commented Feb 28, 2018

We should add an invariant of some sort. pathname is a required field (you can't delete window.location.pathname).

@timdorr timdorr added the bug label Feb 28, 2018
@hellqvist
Copy link
Author

No but Link (and NavLink) is working today with only search set. It will only set the query and leave the actual path as it is. In 4.2.2 NavLink is working fine with only search. As long as no special characters is used in the path

@timdorr
Copy link
Member

timdorr commented Feb 28, 2018

That's because #5596 landed after 4.2.2 was released.

But that brings up a good point. The check for a blank pathname would be better.

@timdorr
Copy link
Member

timdorr commented Feb 28, 2018

Fixed in 6d9c425. Thanks!

@timdorr timdorr closed this as completed Feb 28, 2018
@hellqvist
Copy link
Author

Great job

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants