From 3f047eb13cc8bc3d5208fb34600aa4d611c50f3b Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 12 Dec 2024 15:48:14 +0400 Subject: [PATCH] Fallback on falsy values --- .../editor/src/components/provider/index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index 68d7bd1d3f4f5b..2b171e1d900ff6 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -180,23 +180,25 @@ export const ExperimentalEditorProvider = withRegistryProvider( getRenderingMode, __unstableIsEditorReady, } = select( editorStore ); - const { getEntitiesConfig } = select( coreStore ); + const { + getEntitiesConfig, + getPostType, + hasFinishedResolution, + } = select( coreStore ); - const postTypeObject = select( coreStore ).getPostType( - post.type + const postTypeObject = getPostType( post.type ); + const _hasLoadedPostObject = hasFinishedResolution( + 'getPostType', + [ post.type ] ); - const _hasLoadedPostObject = select( - coreStore - ).hasFinishedResolution( 'getPostType', [ post.type ] ); - return { hasLoadedPostObject: _hasLoadedPostObject, editorSettings: getEditorSettings(), isReady: __unstableIsEditorReady(), mode: getRenderingMode(), defaultMode: - postTypeObject?.default_rendering_mode ?? 'post-only', + postTypeObject?.default_rendering_mode || 'post-only', selection: getEditorSelection(), postTypeEntities: post.type === 'wp_template'