Skip to content

Commit

Permalink
fix only apply default rendering mode on load
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiankaegy committed Nov 15, 2024
1 parent b94e309 commit a742e4a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ export const ExperimentalEditorProvider = withRegistryProvider(
selection,
isReady,
mode,
defaultMode,
postTypeEntities,
hasLoadedPostObject,
} = useSelect(
( select ) => {
const {
getEditorSettings,
getEditorSelection,
getRenderingMode,
__unstableIsEditorReady,
} = select( editorStore );
const { getEntitiesConfig } = select( coreStore );
Expand All @@ -191,7 +193,9 @@ export const ExperimentalEditorProvider = withRegistryProvider(
hasLoadedPostObject: _hasLoadedPostObject,
editorSettings: getEditorSettings(),
isReady: __unstableIsEditorReady(),
mode: postTypeObject?.default_rendering_mode ?? 'post-only',
mode: getRenderingMode(),
defaultMode:
postTypeObject?.default_rendering_mode ?? 'post-only',
selection: getEditorSelection(),
postTypeEntities:
post.type === 'wp_template'
Expand Down Expand Up @@ -322,8 +326,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(

// Sets the right rendering mode when loading the editor.
useEffect( () => {
setRenderingMode( mode );
}, [ mode, setRenderingMode ] );
setRenderingMode( defaultMode );
}, [ defaultMode, setRenderingMode ] );

useHideBlocksFromInserter( post.type, mode );

Expand Down

0 comments on commit a742e4a

Please sign in to comment.