From 7b905f6df2982be194725f104cda39955675d42f Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Fri, 25 Oct 2024 14:48:30 +0200 Subject: [PATCH] fix logic --- lib/compat/wordpress-6.8/template-parts.php | 2 +- packages/editor/src/store/selectors.js | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/compat/wordpress-6.8/template-parts.php b/lib/compat/wordpress-6.8/template-parts.php index 1f126d1bdd98ee..7f7fb32a0e6a5e 100644 --- a/lib/compat/wordpress-6.8/template-parts.php +++ b/lib/compat/wordpress-6.8/template-parts.php @@ -31,7 +31,7 @@ function gutenberg_add_default_template_types_to_index( WP_REST_Response $respon $indexed_template_types[] = $template_type; } - $response->data['defaultTemplateTypes'] = indexed_template_types(); + $response->data['defaultTemplateTypes'] = $indexed_template_types; return $response; } diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js index 3aa1c4daca96e7..493675b4513489 100644 --- a/packages/editor/src/store/selectors.js +++ b/packages/editor/src/store/selectors.js @@ -1716,15 +1716,17 @@ export const __experimentalGetDefaultTemplateTypes = createRegistrySelector( * @return {Array} The template part areas. */ export const __experimentalGetDefaultTemplatePartAreas = createRegistrySelector( - ( select ) => () => { - const areas = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.defaultTemplatePartAreas ?? []; - - return areas.map( ( item ) => { - return { ...item, icon: getTemplatePartIcon( item.icon ) }; - } ); - } + ( select ) => + createSelector( () => { + const areas = select( coreStore ).getEntityRecord( + 'root', + '__unstableBase' + ); + + return areas.map( ( item ) => { + return { ...item, icon: getTemplatePartIcon( item.icon ) }; + } ); + } ) ); /**