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 c286d1d commit eb091e2
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

1 comment on commit eb091e2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in eb091e2.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5532884208
📝 Reported issues:

Please sign in to comment.