Skip to content

Commit

Permalink
Global Styles: Don't call store actions during the render (#67146)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: getdave <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2024
1 parent b408e17 commit 110471f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { __ } from '@wordpress/i18n';
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { useDispatch } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
import { useEffect } from '@wordpress/element';

/**
* Internal dependencies
Expand All @@ -22,7 +23,9 @@ function ScreenStyleVariations() {
// - "Desktop" device preview
const { setDeviceType } = useDispatch( editorStore );
useZoomOut();
setDeviceType( 'desktop' );
useEffect( () => {
setDeviceType( 'desktop' );
}, [ setDeviceType ] );

return (
<>
Expand Down

0 comments on commit 110471f

Please sign in to comment.