Skip to content

Commit

Permalink
Site Editor: Reset device preview type when exiting the editing mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jul 12, 2023
1 parent af38c95 commit 1195d1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/edit-site/src/components/site-hub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ const SiteHub = forwardRef( ( props, ref ) => {
const { open: openCommandCenter } = useDispatch( commandsStore );

const disableMotion = useReducedMotion();
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
const {
setCanvasMode,
__experimentalSetPreviewDeviceType: setPreviewDeviceType,
} = unlock( useDispatch( editSiteStore ) );
const { clearSelectedBlock } = useDispatch( blockEditorStore );
const isBackToDashboardButton = canvasMode === 'view';
const siteIconButtonProps = isBackToDashboardButton
Expand All @@ -67,6 +70,7 @@ const SiteHub = forwardRef( ( props, ref ) => {
event.preventDefault();
if ( canvasMode === 'edit' ) {
clearSelectedBlock();
setPreviewDeviceType( 'desktop' );
setCanvasMode( 'view' );
}
},
Expand Down

0 comments on commit 1195d1a

Please sign in to comment.