You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @sapegin !
I started looking into this issue and found the root cause, Do you mind if I work on this?
It's going to be a first-time open source PR for me.
Okay so the issue lies in the fact that the ComponentsListRenderer sets the isSelectedItem const according to the hasHash function, which checks for indexof, Thus Nav returns true for routes like NavLink. I reproduced it by changing CounterButton to ButtonCounter for example and colliding with Button.
IMO we can simplify this and check in ComponentsListRenderer for equality by comparing the 2 strings Instead of doing this: const isItemSelected = hasInHash(windowHash, href);
We can simply do this: const isItemSelected = windowHash === href;
Questions: 1. I prefer this simple logic to live in the ComponentsListRenderer seems to make sense for me, WDYT?
2. All tests pass with this change, and I saw that all the tests for ComponentsListRenderer are snapshots, Which also missed this edge case in the first place. Should I add specific tests for this edge case or leave this as is with the snapshot tests only?
guyius
added a commit
to guyius/react-styleguidist
that referenced
this issue
Dec 29, 2018
Current behavior
Several sections are highlighted when the current section contains part of a name of a section in the sidebar.
To reproduce
Expected behavior
Only one section is highlighted.
The text was updated successfully, but these errors were encountered: