Skip to content

Commit

Permalink
Block Editor: Fix dependencies of selectors depending on editorTool pref
Browse files Browse the repository at this point in the history
The `state.editorMode` reducer was removed in 65945 in favour of
persisted user preferences. Selector `__unstableGetEditorMode` should be
used instead.

This commit fixes a bug wherein changes to `editorTool` don't trigger a
re-render of the block list view.

See: #65945
  • Loading branch information
mcsf committed Nov 7, 2024
1 parent ab6e729 commit 806557b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
getClientIdsWithDescendants,
isNavigationMode,
getBlockRootClientId,
__unstableGetEditorMode,
} from './selectors';
import {
checkAllowListRecursive,
Expand Down Expand Up @@ -116,7 +117,7 @@ export const getEnabledClientIdsTree = createSelector(
state.blockEditingModes,
state.settings.templateLock,
state.blockListSettings,
state.editorMode,
__unstableGetEditorMode( state ),
state.zoomLevel,
getSectionRootClientId( state ),
]
Expand Down
3 changes: 2 additions & 1 deletion packages/block-editor/src/store/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { selectBlockPatternsKey } from './private-keys';
import { unlock } from '../lock-unlock';
import { STORE_NAME } from './constants';
import { getSectionRootClientId } from './private-selectors';
import { __unstableGetEditorMode } from './selectors';

export const isFiltered = Symbol( 'isFiltered' );
const parsedPatternCache = new WeakMap();
Expand Down Expand Up @@ -117,7 +118,7 @@ export function getInsertBlockTypeDependants( state, rootClientId ) {
state.settings.allowedBlockTypes,
state.settings.templateLock,
state.blockEditingModes,
state.editorMode,
__unstableGetEditorMode( state ),
getSectionRootClientId( state ),
];
}

0 comments on commit 806557b

Please sign in to comment.