Skip to content

Commit

Permalink
Use selector to get preference directly from preferences store
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Jan 30, 2024
1 parent 7443e16 commit f216156
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/editor/src/components/mode-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { __ } from '@wordpress/i18n';
import { MenuItemsChoice, MenuGroup } from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
Expand Down Expand Up @@ -33,7 +34,9 @@ function ModeSwitcher( {
} ) {
const { mode } = useSelect(
( select ) => ( {
mode: select( editorStore ).getEditorMode(),
mode:
select( preferencesStore ).get( 'core', 'editorMode' ) ??
'visual',
} ),
[]
);
Expand Down

0 comments on commit f216156

Please sign in to comment.