Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Oct 25, 2024
1 parent 95d6d1c commit 7b905f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.8/template-parts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
20 changes: 11 additions & 9 deletions packages/editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) };
} );
} )
);

/**
Expand Down

0 comments on commit 7b905f6

Please sign in to comment.