diff --git a/blocks/block-edit/index.js b/blocks/block-edit/index.js index c8bcdeccb8fed4..87d89199fa014f 100644 --- a/blocks/block-edit/index.js +++ b/blocks/block-edit/index.js @@ -8,7 +8,7 @@ import { withFilters } from '@wordpress/components'; */ import { getBlockType } from '../api'; -function BlockEdit( props ) { +export function BlockEdit( props ) { const { name, ...editProps } = props; const blockType = getBlockType( name ); diff --git a/blocks/block-edit/test/index.js b/blocks/block-edit/test/index.js index c24648e6f47959..b02185797b43bc 100644 --- a/blocks/block-edit/test/index.js +++ b/blocks/block-edit/test/index.js @@ -7,7 +7,7 @@ import { noop } from 'lodash'; /** * Internal dependencies */ -import BlockEdit from '../'; +import { BlockEdit } from '../'; import { registerBlockType, unregisterBlockType, diff --git a/components/higher-order/with-filters/index.js b/components/higher-order/with-filters/index.js index b345596efb9982..34eeb87340542c 100644 --- a/components/higher-order/with-filters/index.js +++ b/components/higher-order/with-filters/index.js @@ -1,16 +1,30 @@ /** * WordPress dependencies */ +import { Component, getWrapperDisplayName } from '@wordpress/element'; import { applyFilters } from '@wordpress/hooks'; /** * Creates a higher-order component which adds filtering capability to the wrapped component. + * Filters get applied when the original component is about to be mounted. * * @param {String} hookName Hook name exposed to be used by filters. - * @return {Function} Higher-order component factory. + * @return {Function} Higher-order component factory. */ export default function withFilters( hookName ) { return ( OriginalComponent ) => { - return applyFilters( hookName, OriginalComponent ); + class FilteredComponent extends Component { + constructor( props ) { + super( props ); + this.Component = applyFilters( hookName, OriginalComponent ); + } + + render() { + return ; + } + } + FilteredComponent.displayName = getWrapperDisplayName( OriginalComponent, 'filters' ); + + return FilteredComponent; }; }