Skip to content

Commit

Permalink
Small code quality improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Jun 5, 2023
1 parent e915ba9 commit e196939
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,13 @@ function SidebarNavigationScreenGlobalStylesContent() {
// rendering the iframe. Without this, the iframe previews will not render
// in mobile viewport sizes, where the editor canvas is hidden.
return (
<>
<BlockEditorProvider
settings={ storedSettings }
onChange={ noop }
onInput={ noop }
>
<StyleVariationsContainer />
</BlockEditorProvider>
</>
<BlockEditorProvider
settings={ storedSettings }
onChange={ noop }
onInput={ noop }
>
<StyleVariationsContainer />
</BlockEditorProvider>
);
}

Expand All @@ -107,7 +105,7 @@ function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
}, [] );

const hasRevisions = revisionsCount >= 2;
const { modified } = revisions?.[ 0 ] || {};
const modified = revisions?.[ 0 ]?.modified;

if ( ! hasRevisions || isLoading || ! modified ) {
return null;
Expand Down Expand Up @@ -164,13 +162,13 @@ export default function SidebarNavigationScreenGlobalStyles() {
[ setCanvasMode, openGeneralSidebar ]
);

const openStyleBook = async () => {
const openStyleBook = useCallback( async () => {
await openGlobalStyles();
// Open the Style Book once the canvas mode is set to edit,
// and the global styles sidebar is open. This ensures that
// the Style Book is not prematurely closed.
setEditorCanvasContainerView( 'style-book' );
};
}, [ openGlobalStyles, setEditorCanvasContainerView ] );

const openRevisions = useCallback( async () => {
await openGlobalStyles();
Expand Down

0 comments on commit e196939

Please sign in to comment.