Skip to content

Commit

Permalink
enhacements
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Dec 23, 2024
1 parent 448e9be commit bec0e41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/core-data/src/private-selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ export const getHomePage = createRegistrySelector( ( select ) =>
canUser( state, 'read', {
kind: 'root',
name: 'site',
} ),
getEntityRecord( state, 'root', 'site' ),
} ) && getEntityRecord( state, 'root', 'site' ),
getDefaultTemplateId( state, {
slug: 'front-page',
} ),
Expand Down
11 changes: 7 additions & 4 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,17 @@ export const ExperimentalEditorProvider = withRegistryProvider(
isReady: __unstableIsEditorReady(),
mode: getRenderingMode(),
defaultMode:
postTypeObject?.default_rendering_mode ?? 'post-only',
hasTemplate && postTypeObject?.default_rendering_mode
? postTypeObject?.default_rendering_mode
: 'post-only',
selection: getEditorSelection(),
postTypeEntities:
post.type === 'wp_template'
? getEntitiesConfig( 'postType' )
: null,
};
},
[ post.type ]
[ post.type, hasTemplate ]
);

const shouldRenderTemplate = !! template && mode !== 'post-only';
Expand Down Expand Up @@ -309,6 +311,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
recovery,
setupEditor,
updatePostLock,
hasTemplate,
] );

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

// Sets the right rendering mode when loading the editor.
useEffect( () => {
setRenderingMode( hasTemplate ? defaultMode : 'post-only' );
}, [ hasTemplate, defaultMode, setRenderingMode ] );
setRenderingMode( defaultMode );
}, [ setRenderingMode, defaultMode ] );

useHideBlocksFromInserter( post.type, mode );

Expand Down

0 comments on commit bec0e41

Please sign in to comment.