Skip to content

Commit

Permalink
Use BHE hydration for All Products Block
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Jul 29, 2022
1 parent 6e39a2c commit 23b0f51
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions assets/js/blocks/products/all-products/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,30 @@ import { renderFrontend } from '@woocommerce/base-utils';
/**
* Internal dependencies
*/
import Block from './block';
import Block from './block.js';
import { registerBlockType } from '../../../base/utils/bhe-frontend';

/**
* Wrapper component to supply the notice provider.
*
* @param {*} props
*/
const AllProductsFrontend = ( props ) => {
return (
<StoreNoticesProvider context="wc/all-products">
<Block { ...props } />
</StoreNoticesProvider>
);
};
// const AllProductsFrontend = ( props ) => {
// return (
// <StoreNoticesProvider context="wc/all-products">
// <Block { ...props } />
// </StoreNoticesProvider>
// );
// };

const getProps = ( el ) => ( {
attributes: JSON.parse( el.dataset.attributes ),
} );
// const getProps = ( el ) => ( {
// attributes: JSON.parse( el.dataset.attributes ),
// } );

renderFrontend( {
selector: '.wp-block-woocommerce-all-products',
Block: AllProductsFrontend,
getProps,
} );
// renderFrontend( {
// selector: '.wp-block-woocommerce-all-products',
// Block: AllProductsFrontend,
// getProps,
// } );

registerBlockType( 'woocommerce/all-products', Block );

0 comments on commit 23b0f51

Please sign in to comment.