Fix sidebar active state after navigation#6547
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the NavItem component to use the useLocation hook from react-router-dom instead of accessing document.location.pathname directly, and adds location.pathname to the useEffect dependency array to ensure the active menu item updates correctly on route changes. The reviewer suggested optimizing this hook by checking if the menu item is already open before dispatching MENU_OPEN to prevent redundant Redux dispatches and unnecessary re-renders, as well as caching the split pathname.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Summary
Fixes #6510
Tests
git diff --checkpnpm --dir packages/ui build