Skip to content

Commit bec0e41

Browse files
enhacements
1 parent 448e9be commit bec0e41

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/core-data/src/private-selectors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ export const getHomePage = createRegistrySelector( ( select ) =>
171171
canUser( state, 'read', {
172172
kind: 'root',
173173
name: 'site',
174-
} ),
175-
getEntityRecord( state, 'root', 'site' ),
174+
} ) && getEntityRecord( state, 'root', 'site' ),
176175
getDefaultTemplateId( state, {
177176
slug: 'front-page',
178177
} ),

packages/editor/src/components/provider/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,17 @@ export const ExperimentalEditorProvider = withRegistryProvider(
196196
isReady: __unstableIsEditorReady(),
197197
mode: getRenderingMode(),
198198
defaultMode:
199-
postTypeObject?.default_rendering_mode ?? 'post-only',
199+
hasTemplate && postTypeObject?.default_rendering_mode
200+
? postTypeObject?.default_rendering_mode
201+
: 'post-only',
200202
selection: getEditorSelection(),
201203
postTypeEntities:
202204
post.type === 'wp_template'
203205
? getEntitiesConfig( 'postType' )
204206
: null,
205207
};
206208
},
207-
[ post.type ]
209+
[ post.type, hasTemplate ]
208210
);
209211

210212
const shouldRenderTemplate = !! template && mode !== 'post-only';
@@ -309,6 +311,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
309311
recovery,
310312
setupEditor,
311313
updatePostLock,
314+
hasTemplate,
312315
] );
313316

314317
// Synchronizes the active post with the state
@@ -328,8 +331,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(
328331

329332
// Sets the right rendering mode when loading the editor.
330333
useEffect( () => {
331-
setRenderingMode( hasTemplate ? defaultMode : 'post-only' );
332-
}, [ hasTemplate, defaultMode, setRenderingMode ] );
334+
setRenderingMode( defaultMode );
335+
}, [ setRenderingMode, defaultMode ] );
333336

334337
useHideBlocksFromInserter( post.type, mode );
335338

0 commit comments

Comments
 (0)