Skip to content

Commit

Permalink
Downloadable Block List: do not use composite store (#65038)
Browse files Browse the repository at this point in the history
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
  • Loading branch information
3 people authored Sep 4, 2024
1 parent cd77dd9 commit 0a86ab3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function getDownloadableBlockLabel(
);
}

function DownloadableBlockListItem( { composite, item, onClick } ) {
function DownloadableBlockListItem( { item, onClick } ) {
const { author, description, icon, rating, title } = item;
// getBlockType returns a block object if this block exists, or null if not.
const isInstalled = !! getBlockType( item.name );
Expand Down Expand Up @@ -116,7 +116,6 @@ function DownloadableBlockListItem( { composite, item, onClick } ) {
tooltipPosition="top center"
/>
}
store={ composite }
disabled={ isInstalling || ! isInstallable }
>
<div className="block-directory-downloadable-block-list-item__icon">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ import DownloadableBlockListItem from '../downloadable-block-list-item';
import { store as blockDirectoryStore } from '../../store';
import { unlock } from '../../lock-unlock';

const { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore } =
unlock( componentsPrivateApis );
const { CompositeV2: Composite } = unlock( componentsPrivateApis );
const noop = () => {};

function DownloadableBlocksList( { items, onHover = noop, onSelect } ) {
const composite = useCompositeStore();
const { installBlockType } = useDispatch( blockDirectoryStore );

if ( ! items.length ) {
Expand All @@ -27,7 +25,6 @@ function DownloadableBlocksList( { items, onHover = noop, onSelect } ) {

return (
<Composite
store={ composite }
role="listbox"
className="block-directory-downloadable-blocks-list"
aria-label={ __( 'Blocks available for install' ) }
Expand All @@ -36,7 +33,6 @@ function DownloadableBlocksList( { items, onHover = noop, onSelect } ) {
return (
<DownloadableBlockListItem
key={ item.id }
composite={ composite }
onClick={ () => {
// Check if the block is registered (`getBlockType`
// will return an object). If so, insert the block.
Expand Down

0 comments on commit 0a86ab3

Please sign in to comment.