Closed myj009 closed 7 months ago
@myj009 is attempting to deploy a commit to the EddieHub Team on Vercel.
A member of the Team first needs to authorize it.
The update to the SideNav.js
component ensures that sidebar menu links now highlight when clicked, addressing a previously reported bug. This enhancement leverages the usePathname
hook to track the current path and useMemo
for performance optimization, ensuring that the sidebar reflects the user's navigation state efficiently.
File | Change Summary |
---|---|
src/components/SideNav.js |
Integrated usePathname hook and useMemo hook; Renamed and memoized navigation arrays; Conditionally set current property based on path name. |
Objective | Addressed | Explanation |
---|---|---|
Sidebar menu links should highlight upon clicking (#86) | ✅ | |
Performance optimization for sidebar navigation state (#86) | ✅ |
In the code forest deep and wide, A bug did hide, with nowhere to slide. With
usePathname
as my guide, Now the sidebar glows with pride. 🌟🐰
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Not sure if useMemo will do any real benefit as we are not doing any heavy calculations here Thoughts??
Not sure if useMemo will do any real benefit as we are not doing any heavy calculations here Thoughts??
yeah probably not in this case. If useMemo
is not used, can the data be kept in the same location as before?
Fixes Issue 86
Closes #86
Changes proposed
The
current
field in thenavigationMenu
object was assigned a static valuefalse
. Have made it a dynamic value based on the current pathname. Added useMemo to avoid unnecessary recreation of thenavigationMenu
objectCheck List (Check all the applicable boxes)
Screenshots
Note to reviewers
Summary by CodeRabbit