Skip to content

Commit

Permalink
Tidy up effect
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Nov 23, 2021
1 parent 84e0c78 commit 0bd0fab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/edit-site/src/components/navigation-sidebar/index.js
Expand Up @@ -27,15 +27,15 @@ export default function NavigationSidebar( {

useEffect( () => {
// When transitioning to desktop open the navigation if `isDefaultOpen` is true.
if ( isDefaultOpen && isDesktopViewport && ! isNavigationOpen ) {
if ( isDefaultOpen && isDesktopViewport ) {
setIsNavigationOpen( true );
}

// When transitioning to mobile/tablet, close the navigation.
if ( ! isDesktopViewport && isNavigationOpen ) {
if ( ! isDesktopViewport ) {
setIsNavigationOpen( false );
}
}, [ isDefaultOpen, isDesktopViewport, isNavigationOpen ] );
}, [ isDefaultOpen, isDesktopViewport ] );

return (
<>
Expand Down

0 comments on commit 0bd0fab

Please sign in to comment.