Skip to content

Commit

Permalink
Bit of clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Jul 17, 2023
1 parent 5f4e22d commit 23f587e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
10 changes: 3 additions & 7 deletions packages/components/src/higher-order/with-filters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function withFilters( hookName: string ) {
* reuse this shared reference as an optimization to avoid excessive
* calls to `applyFilters` when many instances exist.
*/
let FilteredComponent: React.ComponentType | undefined;
let FilteredComponent: React.ComponentType;

/**
* Initializes the FilteredComponent variable once, if not already
Expand Down Expand Up @@ -94,19 +94,15 @@ export default function withFilters( hookName: string ) {
);

// If this was the last of the mounted components filtered on
// this hook, remove the hook handler and reset the shared
// FilteredComponent reference so that it's recreated on next
// mount.
// this hook, remove the hook handler.
if ( FilteredComponentRenderer.instances.length === 0 ) {
removeAction( 'hookRemoved', namespace );
removeAction( 'hookAdded', namespace );
// FilteredComponent = undefined;
}
}

render() {
const NonNullFilteredComponent = FilteredComponent!;
return <NonNullFilteredComponent { ...this.props } />;
return <FilteredComponent { ...this.props } />;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
const noop = () => {};

export default function ContentBlockEditorProvider( { children } ) {
const defaultSettings = useSiteEditorSettings();
const settings = useMemo( () => {
return {
...defaultSettings,
};
}, [ defaultSettings ] );
const settings = useSiteEditorSettings();

const blocks = useMemo( () => {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ export function useDisableNonPageContentBlocks() {
'core/edit-site/disable-non-content-blocks',
withDisableNonPageContentBlocks
);
return () => {
return () =>
removeFilter(
'editor.BlockEdit',
'core/edit-site/disable-non-content-blocks'
);
};
}, [] );
}

Expand Down

0 comments on commit 23f587e

Please sign in to comment.