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 authored and tellthemachines committed Jul 13, 2023
1 parent 1591f04 commit 21eb6d5
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 21eb6d5

Please sign in to comment.