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

Use a DropdownMenu for menu selection in the navigation screen #25390

Merged
merged 10 commits into from
Oct 20, 2020
Prev Previous commit
Next Next commit
Add explanatory comment
  • Loading branch information
talldan committed Sep 17, 2020
commit d6204d5c22c77b6418da236f91cbd23143fb749c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default function MenuSelector( { activeMenuId, menus, onSelectMenu } ) {
const isMobileViewport = useViewportMatch( 'small', '<' );
const [ selectedMenuId, setSelectedMenuId ] = useState( activeMenuId );

// If the activeMenuId changes for any reason external to the selector,
// e.g. creating a new menu, update the value to match.
useEffect( () => {
if ( activeMenuId !== selectedMenuId ) {
setSelectedMenuId( activeMenuId );
Expand Down