Skip to content

Commit

Permalink
Fix useDispatch for setEditorMode action
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Jan 30, 2024
1 parent 09fa3fe commit 29c8a6e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/editor/src/components/mode-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
* Internal dependencies
*/
import { store as editorStore } from '../../store';
import { unlock } from '../../lock-unlock';

/**
* Set of available mode options.
Expand Down Expand Up @@ -40,7 +41,7 @@ function ModeSwitcher( {
} ),
[]
);
const { switchEditorMode } = useDispatch( editorStore );
const { setEditorMode } = unlock( useDispatch( editorStore ) );

let selectedMode = mode;
if ( ! isRichEditingEnabled && mode === 'visual' ) {
Expand Down Expand Up @@ -77,7 +78,7 @@ function ModeSwitcher( {
<MenuItemsChoice
choices={ choices }
value={ mode }
onSelect={ switchEditorMode }
onSelect={ setEditorMode }
/>
</MenuGroup>
);
Expand Down

0 comments on commit 29c8a6e

Please sign in to comment.