Skip to content

Commit

Permalink
move preference toggle out of async chain
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed Jun 30, 2023
1 parent 3240249 commit 0d42b23
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,13 @@ export default function SidebarNavigationScreenGlobalStyles() {
} );
}, [ createNotice, setPreference, getPrefference ] );

const openGlobalStyles = useCallback(
async () =>
Promise.all( [
setCanvasMode( 'edit' ),
openGeneralSidebar( 'edit-site/global-styles' ),
turnOffDistractionFreeMode(),
] ),
[ setCanvasMode, openGeneralSidebar, turnOffDistractionFreeMode ]
);
const openGlobalStyles = useCallback( async () => {
turnOffDistractionFreeMode();
return Promise.all( [
setCanvasMode( 'edit' ),
openGeneralSidebar( 'edit-site/global-styles' ),
] );
}, [ setCanvasMode, openGeneralSidebar, turnOffDistractionFreeMode ] );

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

0 comments on commit 0d42b23

Please sign in to comment.